Skip to content

Instantly share code, notes, and snippets.

@RamiAwar
Created October 28, 2021 10:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RamiAwar/44cc18749571dc93c857c2c12c101955 to your computer and use it in GitHub Desktop.
Save RamiAwar/44cc18749571dc93c857c2c12c101955 to your computer and use it in GitHub Desktop.
def verify_image(file):
"""Verifies that file is a valid image"""
return file.ext in ("jpg", "jpeg", "png")
def store_file(file):
"""Uploads a file to the document storage server, returns URL"""
pass
def upload_image(file):
"""API route to upload image"""
if verify_image(file):
return store_file(file)
else:
raise HTTPException(400, "Invalid image")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment