Skip to content

Instantly share code, notes, and snippets.

@asjohnston-asf
Last active February 5, 2020 19:05
Show Gist options
  • Save asjohnston-asf/0a94cd31bd0943a8eb85102b4cfaa2b3 to your computer and use it in GitHub Desktop.
Save asjohnston-asf/0a94cd31bd0943a8eb85102b4cfaa2b3 to your computer and use it in GitHub Desktop.
@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