аватар question@mail.ru · 01.01.1970 03:00

how to download files with Yandex disk

There is a file: (it is open) How can I download it? Authorization is not needed, etc.

аватар answer@mail.ru · 01.01.1970 03:00

Here is a code for downloading a published file. (For some reason, your link is non-working, I have inserted my link for example. Replace it with my worker when you have it)

   Import  Requests  from  urllib.parse  import  urlencodebase_url =  'https://cloud-api.yandex.net/v1/disk/public/resources/download? class = ""> 'https://yadi.sk/d/uj8vmk2y6bjh7a'  # here enter your link   # we get a boot link  final_url = Base_url + urlencode ( dict  (public_key = public_key)) response = readers.get (final_url) dowload_url = response.json () [ 'HREF' ]  # upload the file and save it  download_Response = readers.get (download_url)   ground   open  ( 'download_file.txt' ,  'wb' )  as # "indicate here The right path to the file   F.Write (download_Response.Content)                                       

Latest

Similar