Update wrapper.py
This commit is contained in:
		@@ -126,14 +126,14 @@ def newest(url, UA=default_UA):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
def total_archives(url, UA=default_UA):
 | 
					def total_archives(url, UA=default_UA):
 | 
				
			||||||
    url_check(url)
 | 
					    url_check(url)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    hdr = { 'User-Agent' : '%s' % UA }
 | 
					    hdr = { 'User-Agent' : '%s' % UA }
 | 
				
			||||||
    request_url = "https://web.archive.org/cdx/search/cdx?url=%s&output=json" % clean_url(url)
 | 
					    request_url = "https://web.archive.org/cdx/search/cdx?url=%s&output=json" % clean_url(url)
 | 
				
			||||||
    req = Request(request_url, headers=hdr) # nosec
 | 
					    req = Request(request_url, headers=hdr) # nosec
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    try:
 | 
					    try:
 | 
				
			||||||
        response = urlopen(req) #nosec
 | 
					        response = urlopen(req) #nosec
 | 
				
			||||||
    except HTTPError as e:
 | 
					    except HTTPError as e:
 | 
				
			||||||
        if e.code == 502:
 | 
					        handle_HTTPError(e)
 | 
				
			||||||
            raise BadGateWay(e)
 | 
					
 | 
				
			||||||
        elif e.code == 503:
 | 
					 | 
				
			||||||
            raise WaybackUnavailable(e)
 | 
					 | 
				
			||||||
    return (len(json.loads(response.read())))
 | 
					    return (len(json.loads(response.read())))
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user