Skip to content

Instantly share code, notes, and snippets.

@KyMidd
Created February 14, 2025 01:32
Show Gist options
  • Select an option

  • Save KyMidd/7e87b88a7b3b503b3e38f3e14cabf642 to your computer and use it in GitHub Desktop.

Select an option

Save KyMidd/7e87b88a7b3b503b3e38f3e14cabf642 to your computer and use it in GitHub Desktop.
# 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