Implement cache busting
This commit is contained in:
parent
d1b1185bfc
commit
abe85d85ff
|
@ -307,8 +307,17 @@ def build_request(url, data=None, headers={}):
|
||||||
else:
|
else:
|
||||||
schemed_url = url
|
schemed_url = url
|
||||||
|
|
||||||
|
if '?' in url:
|
||||||
|
delim = '&'
|
||||||
|
else:
|
||||||
|
delim = '?'
|
||||||
|
|
||||||
|
# WHO YOU GONNA CALL? CACHE BUSTERS!
|
||||||
|
final_url = '%s%sx=%s' % (schemed_url, delim,
|
||||||
|
int(timeit.time.time() * 1000))
|
||||||
|
|
||||||
headers['User-Agent'] = USER_AGENT
|
headers['User-Agent'] = USER_AGENT
|
||||||
return Request(schemed_url, data=data, headers=headers)
|
return Request(final_url, data=data, headers=headers)
|
||||||
|
|
||||||
|
|
||||||
def catch_request(request):
|
def catch_request(request):
|
||||||
|
@ -695,7 +704,9 @@ class Speedtest(object):
|
||||||
errors = []
|
errors = []
|
||||||
for url in urls:
|
for url in urls:
|
||||||
try:
|
try:
|
||||||
request = build_request(url)
|
request = build_request('%s?threads=%s' %
|
||||||
|
(url,
|
||||||
|
self.config['threads']['download']))
|
||||||
uh, e = catch_request(request)
|
uh, e = catch_request(request)
|
||||||
if e:
|
if e:
|
||||||
errors.append('%s' % e)
|
errors.append('%s' % e)
|
||||||
|
|
Loading…
Reference in New Issue