-
-
Save KyMidd/7e87b88a7b3b503b3e38f3e14cabf642 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
| # If the payload contains files, iterate through them | |
| if "files" in payload: | |
| # Append the payload files to the content array | |
| for file in payload["files"]: | |
| # Debug | |
| if os.environ.get("VERA_DEBUG", "False") == "True": | |
| print("🚀 File found in payload:", file) | |
| # Isolate name of the file and remove characters before the final period | |
| file_name = file["name"].split(".")[0] | |
| # File is a supported type | |
| file_url = file["url_private_download"] | |
| # Fetch the file and continue | |
| file_object = requests.get( | |
| file_url, headers={"Authorization": "Bearer " + token} | |
| ) | |
| # Decode object into binary file | |
| file_content = file_object.content |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment