Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for dynamic module to handle scrape output. #11

Merged

Conversation

doubleswirve
Copy link
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
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