Update wrapper.py

This commit is contained in:
akamhy 2020-05-02 15:15:36 +05:30 committed by GitHub
parent f03a9e786e
commit 5f73504beb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,18 +1,19 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from datetime import datetime from datetime import datetime
from urllib.request import Request, urlopen from urllib.request import Request, urlopen
import urllib.error import urllib.error
# YYYYMMDDhhmmss
class TooManyArchivingRequestsError(Exception): class TooManyArchivingRequestsError(Exception):
"""An error when a single url is archived multiple times in a short timespam. """Error when a single url reqeusted for archiving too many times in a short timespam.
Wayback machine doesn't supports archivng any url too many times in a short period of time. Wayback machine doesn't supports archivng any url too many times in a short period of time.
""" """
class ArchivingNotAllowed(Exception): class ArchivingNotAllowed(Exception):
pass pass
def save(url,UA="pywayback python module"): def save(url,UA="pywayback python module"):
base_save_url = "https://web.archive.org/save/" base_save_url = "https://web.archive.org/save/"
request_url = base_save_url + url request_url = base_save_url + url