Last active
February 5, 2020 19:05
-
-
Save asjohnston-asf/0a94cd31bd0943a8eb85102b4cfaa2b3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
@app.route(....) | |
def list_zip_contents(): | |
try: | |
return do_it() | |
except RemoteIoError as e: | |
status_code = get_status_code(e) | |
abort(status_code) | |
except KeyError as e: | |
return 'no such file...', 400 | |
get_status_code(e): | |
if str(e.startswith('4xx Client Error'): | |
return int(str(e)[0:2]) | |
raise e |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment