Add sort, use_pagination and closest (#158)
* add sort param support in CDX API class see https://nla.github.io/outbackcdx/api.html#operation/query sort takes string input which must be one of the follwoing: - default - closest - reverse This commit shall help in closing issue at https://github.com/akamhy/waybackpy/issues/155 * add BlockedSiteError for cases when archiving is blocked by site's robots.txt * create check_for_blocked_site for handling the BlockedSiteError for sites that are blocking wayback machine by their robots.txt policy * add attrs use_pagination and closest, which are can be used to use the pagination API and lookup archive close to a timestamp respectively. And now to get out of infinte blank pages loop just check for two succesive black and not total two blank pages while using the CDX server API. * added cli support for sort, use-pagination and closest * added tests * fix codeql warnings, nothing to worry about here. * fix save test for archive_url
This commit is contained in:
@@ -35,4 +35,11 @@ def test_total_archives() -> None:
|
||||
|
||||
def test_known_urls() -> None:
|
||||
wayback = Url("akamhy.github.io")
|
||||
assert len(list(wayback.known_urls())) > 40
|
||||
assert len(list(wayback.known_urls(subdomain=True))) > 40
|
||||
|
||||
|
||||
def test_Save() -> None:
|
||||
wayback = Url("https://en.wikipedia.org/wiki/Asymptotic_equipartition_property")
|
||||
wayback.save()
|
||||
archive_url = str(wayback.archive_url)
|
||||
assert archive_url.find("Asymptotic_equipartition_property") != -1
|
||||
|
Reference in New Issue
Block a user