Python Forum
Cannot download latest version of a file
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cannot download latest version of a file
#1
I have gone through over five or six Python requests and urllib tutorials, but none of them will download the latest version of a file.

Here is what happens:

It downloads the latest version of bglug.py successfully. Everything works like a charm.

The second time I try, it doesn't fetch the latest version of the file, but I know it fetches the file because I set it up to delete the file first (just for testing purposes) and when I check, the file is there.

And it still won't download the latest version until the next day or so!

Is this server-side caching? Does Python have a web cache that I have to clear?

My code is as follows:
import requests, os

os.remove("bglug.py")

url = "https://raw.githubusercontent.com/TheTechRobo/bglugwatch-cleanslate/master/bglug.py"

r = requests.get(url, stream = True)

with open("bglug.py", "wb") as Writefile:

    for chunk in r.iter_content(chunk_size = 1024):

        if chunk:

            Writefile.write(chunk)
Does anyone else have the same problem? Thanks!
Reply
#2
(Apr-25-2020, 12:55 PM)TheTechRobo Wrote: Does anyone else have the same problem? Thanks!
No same file every time as i would except for that code,and with a raw url file link to GitHub.
Reply
#3
More details:
After I update bglug.py on GitHub. when I run the mechanism again, it fetches the file, but doesn't include the new commit

I know it isn't that raw.githubusercontent.com hasn't been updated, as even after I verify it in a browser that it changed it still doesn't work.
Reply
#4
OK! So it turns out that raw.githubusercontent.com takes time to update, even though it doesn't seem like it. So I'm marking this as solved. Ciao!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Login and download an exported csv file within a ribbon/button in a website Alekhya 0 3,183 Feb-26-2021, 04:15 PM
Last Post: Alekhya
  To select only the latest value with Selenium codessu 2 2,412 May-16-2020, 03:51 AM
Last Post: codessu
  download pdf file from website m_annur2001 1 3,394 Jun-21-2019, 05:03 AM
Last Post: j.crater
  Flask generating a file for download darktitan 0 3,769 Dec-30-2018, 02:02 PM
Last Post: darktitan
  I Want To Download Many Files Of Same File Extension With Either Wget Or Python, eddywinch82 15 16,289 May-20-2018, 06:05 PM
Last Post: eddywinch82
  Issues running Selenium to download zip file davehughes87 4 6,922 Jan-12-2017, 02:19 PM
Last Post: metulburr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020