Forums

File saving from urlretrieve

Hi dear I am making telegram bots. Using telepot

When the bot receives the file, it tries to upload it back to ftp.

I found the url to download the file I tried to download it with 'urllib.request.urlretrieve', but I do not know if it worked. Where are the files stored? Or did I fail?

Check out the documentation for urlretrieve -- it returns a tuple of the filename and the headers, so you can find out from those where it's stored. For example:

(filename, headers) = urlretrieve(url)
print(filename)