Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sync local file with HTTP server location (in Python)

I have an HTTP server which host some large file and have python clients (GUI apps) which download it.
I want the clients to download the file only when needed, but have an up-to-date file on each run.

I thought each client will download the file on each run using the If-Modified-Since HTTP header with the file time of the existing file, if any. Can someone suggest how to do it in python?

Can someone suggest an alternative, easy, way to achieve my goal?

like image 860
Uri Cohen Avatar asked Nov 26 '25 01:11

Uri Cohen


1 Answers

You can add a header called ETag, (hash of your file, md5sum or sha256 etc ), to compare if two files are different instead of last-modified date

like image 157
TheOneTeam Avatar answered Nov 28 '25 16:11

TheOneTeam



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!