Skip to content
This repository has been archived by the owner on Apr 24, 2019. It is now read-only.

Add scraperwiki notifier #2

Open
luiscape opened this issue Jul 24, 2015 · 2 comments
Open

Add scraperwiki notifier #2

luiscape opened this issue Jul 24, 2015 · 2 comments

Comments

@luiscape
Copy link
Contributor

In order for the "status" of the ScraperWiki boxes to be active, we need to add something like this to when the script ends:

import scraperwiki

try:
  # Script runs.
  scraperwiki.status('ok')

except Exception as e:
  # Script fails.
  scraperwiki.status('error', e)

That helps determine the status of boxes / scripts.

@reubano
Copy link
Member

reubano commented Jul 24, 2015

gotcha.... thanks! btw, do you know what error SW throws? It's better to catch a specific exception.

@luiscape
Copy link
Contributor Author

I am not sure. However, that try: should catch errors within your scripts. Depending on the error, you may decide how to handle it instead of using the generic except Exception as e. The second parameter in `status('error', e)' should be the message of a particular error. That message is useful for sending in an email or displaying in the ScraperWiki dashboard.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants