[Complete] Download files with Python

I’m getting my files in the board as URL, what I’m trying is to download this file from Python, but only gives a file that’s not compatible, my code is working fine with any other URL, so I think is happening because I’m not loggin in, this is my code:

url1 = 'https://xxxxx-cast.monday.com/'
#email, password = 'xxxxx@gmail.com', 'xxxxxxx'
#resp = requests.get(url1, auth=(email, password))
url = 'https://xxxxx-cast.monday.com/protected_static/12345678/resources/987654321/pythonLogo.png'
myfile = requests.get(url)
open('C:/Users/INECH/Desktop/Estad/ooooo.png', 'wb').write(myfile.content)

Like I said, it download the file but I can’t open it, I don’t know if maybe I need more to log in, or the problem is something different

Hey @danyauribe – you’re right, the reason you can’t get the file is because you’re not logged in.

At the moment downloading files programmatically through the API is not supported. However, it’s one of our most requested features and we’re working on it!

Cheers,
Dipro

Hey Dipro,

I would like to ask, is this feature added to the API V2?
I would like to download file with API.

Thank you,
Norbert

Hey @Norbert – we just added this feature! Check it out: https://monday.com/developers/v2#mutations-section-files

1 Like

Hi All,

I am wondering if someone has a working example available as I still get invalid files when using the API V2.

Thanks
Landerson

Hi there, again. I got it working using public_url instead of url.

Case closed.

1 Like

@landerson

Thanks for keeping us posted! That’s a great solution :slight_smile: The “usual” or non-public URLs can only be opened by a user logged in to monday.com, so it is best to use public_urls when downloading programatically.

Happy building!

-Alex

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.