Skip to content

Instantly share code, notes, and snippets.

View hathehuyen's full-sized avatar
🤑

Huyen Ha hathehuyen

🤑
  • Vietnam
View GitHub Profile
@hathehuyen
hathehuyen / download.py
Last active June 12, 2017 06:50
Download url to file with buffered read and progress display
#!/usr/bin/python
from urllib2 import urlopen
from datetime import datetime
from rfc822 import parsedate_tz
# Download url to file with buffered read and progress display
def download(url, file_name):
u = urlopen(url)
f = open(file_name, 'wb')
@hathehuyen
hathehuyen / check_last_modified.py
Last active June 12, 2017 06:49
Check last modified time of an url using Last-Modified header
#!/usr/bin/python
from urllib2 import urlopen
from datetime import datetime
from rfc822 import parsedate_tz
# Check last modified time of an url using Last-Modified header
def check_last_modified(url):
u = urlopen(url)
meta = u.info()