Downloading Files saved on Monday.com

Hi,

My team and I have been keeping information about our products as a board, and lately started documenting all of our product-related files on Monday as well. I added a PDF as an example as both an update and as a file under “Info Box”. I didn’t try the files column, since all posts about it say it won’t be available anytime soon.

My need is pretty simple - we have a system in place that requests information about our products from Monday using API V2, and I need to do the same with our files. However, I see that API V2 doesn’t support requesting files saved as updates, only their link.

I’m using GraphQL to get the URL of the file, and that’s the response I get for the updates:

  {
    "body": "<p> <br> <a href=\"[File_URL]\" data-asset_id=\"[ID]\" target=\"_blank\" rel=\"noopener noreferrer\">[File_Name]</a> <br> </p>",
    "id": [Update_ID]
  }

So far so good, but now I’m encountering some “error 401: Unauthorized” problems while trying to download it. When I try to retrieve the file using the File_URL (Python) -

>>> import urllib.request
>>> manager = urllib.request.HTTPPasswordMgrWithDefaultRealm()
>>> username = [My_Username]
>>> password = [My_Password]
>>> baseurl = "https://[Our_Company].monday.com"
>>> manager.add_password(None, baseurl, username, password)
>>> auth = urllib.request.HTTPBasicAuthHandler(manager)
>>> opener = urllib.request.build_opener(auth)
>>> urllib.request.install_opener(opener)
>>> reponse = urllib.request.urlopen(baseurl + [rest of File_URL])

Error -

**raise HTTPError(req.full_url, code, msg, hdrs, fp)**
**urllib.error.HTTPError: HTTP Error 401: Unauthorized**

Trying to use “www.monday.com” as baseurl returns error 308: Permanent Redirect.

Anyone has a better solution for downloading those files? :grin:

Thanks!