Python Forum

Full Version: Cannot download latest version of a file
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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!
(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.
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.
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!