Created
October 28, 2021 10:14
-
-
Save RamiAwar/44cc18749571dc93c857c2c12c101955 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
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