I am trying to download a single submission that has been annotated by a grader using the API. Does anyone know how to do this? I am using Python using the canvasapi and requests libraries to query the preview_url in the submission attachments.
import requests
from urllib.parse import urljoin
preview_url = submission.attachments[0].preview_url
url = urljoin(API_URL, preview_url)
# Set the request
headers = {"Authorization": f"Bearer {API_TOKEN}"}
response = requests.get(url, headers=headers)
The response is html. In the html there is a sessionData dictionary with an attribute "annotated_pdf_download" that has the format "/1/sessions/...abc123 .../view/annotated.pdf"
Anyone know how to extract the direct link? I am also open to trying Postman, curl, and other ways.