Skip to content

Allow for dynamic module to handle scrape output.#11

Merged
jamesturk merged 1 commit intoopenstates:masterfrom
GovHawkDC:features/simpler-alternative-outputters
Apr 14, 2020
Merged

Allow for dynamic module to handle scrape output.#11
jamesturk merged 1 commit intoopenstates:masterfrom
GovHawkDC:features/simpler-alternative-outputters

Conversation

@doubleswirve
Copy link
Copy Markdown
Contributor

Howdy,

This PR allows users to specify a module to handle scrape objects as an alternative to writing them to files. This user module name can be specified via the environment variable SCRAPE_OUTPUT_HANDLER. Once imported, the module expects the following class structure to be available:

class Handler:

    def __init__(self, scraper):
        # Custom code...
        pass

    def handle(self, obj):
        # Custom code...
        pass

This is related to opencivicdata/pupa#315 but is much lighter and does not impose additional dependencies.

Thanks!

@jamesturk
Copy link
Copy Markdown
Member

👍

@jamesturk jamesturk merged commit 4078306 into openstates:master Apr 14, 2020
jamesturk added a commit that referenced this pull request May 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants