Skip to content

Instantly share code, notes, and snippets.

@ernestom
Created February 27, 2014 19:49
Show Gist options
  • Save ernestom/9257960 to your computer and use it in GitHub Desktop.
Save ernestom/9257960 to your computer and use it in GitHub Desktop.
import requests
URLS = """
http://www.liverpool.com.mx/assets/js/jquery-ui.js
http://www.liverpool.com.mx/assets/js/script_main.js
http://www.liverpool.com.mx/shopping/assets/js/js_store/mini_login.js
http://www.liverpool.com.mx/assets/js/endeca-auto-suggest.js
http://www.liverpool.com.mx/assets/js/jquery-1.7.1.min.js
http://www.liverpool.com.mx/shopping/assets/js/js_store/fancybox_all_custom.js
http://www.liverpool.com.mx/assets/js/modernizr.custom.79639.js
http://www.liverpool.com.mx/assets/js/jquery.mCustomScrollbar.concat.min.js
http://www.liverpool.com.mx/assets/utils/tabs/js/jquery.slidingtabs.pack.js
http://www.liverpool.com.mx/assets/utils/tabs/js/plugins/jquery.easing.1.3.js
http://www.liverpool.com.mx/assets/utils/gallery/js/jquery.etalage.js
"""
headers = {'Pragma': 'akamai-x-cache-on, akamai-x-get-cache-key, akamai-x-check-cacheable'}
for url in [u for u in URLS.split() if u]:
r = requests.get(url, headers=headers)
print url
print 'Cacheable: ' + r.headers['x-check-cacheable']
print 'Cached: ' + ('YES' if r.headers['x-cache'].find('HIT') > 0 else 'NO')
print 'TTL: ' + r.headers['x-cache-key'].split('/')[4]
print
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment