Update wrapper.py

This commit is contained in:
akamhy 2020-05-02 15:46:02 +05:30 committed by GitHub
parent 69f265ccff
commit af1ac96d48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -44,8 +44,10 @@ def near(
UA="pywayback python module", UA="pywayback python module",
): ):
timestamp = str(year)+str(month)+str(day)+str(hour)+str(minute) timestamp = str(year)+str(month)+str(day)+str(hour)+str(minute)
Rurl = "https://archive.org/wayback/available?url=%s&timestamp=%s" % (str(url), str(timestamp)) request_url = "https://archive.org/wayback/available?url=%s&timestamp=%s" % (str(url), str(timestamp))
response = urlopen(Rurl) #nosec hdr = { 'User-Agent' : '%s' % UA }
req = Request(request_url, headers=hdr)
response = urlopen(req) #nosec
encoding = response.info().get_content_charset('utf8') encoding = response.info().get_content_charset('utf8')
import json import json
data = json.loads(response.read().decode(encoding)) data = json.loads(response.read().decode(encoding))