Created
July 8, 2013 10:52
-
-
Save matthewhughes/5947862 to your computer and use it in GitHub Desktop.
Plurk Scraper 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def main(): | |
try: | |
if len(sys.argv) != 2: | |
raise InvalidArgumentError("Please supply a single argument. An example would be 'kittens'") | |
else: | |
search_plurk(argument) | |
except Exception, e: | |
scraperwiki.status('error', type(e).__name__) | |
print json.dumps({ | |
'error': { | |
'type': type(e).__name__, | |
'message': str(e), | |
'trace': traceback.format_exc() | |
} | |
}) | |
else: | |
scraperwiki.status('ok') | |
print json.dumps({ | |
'success': { | |
'type': 'ok', | |
'message': "Searched Plurk" | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment