mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-24 06:59:52 +01:00
make RemoteCDXServer api conform to LocalCDXServer api, addressing #19
This commit is contained in:
parent
86a093d164
commit
d9c4e5cba4
@ -135,7 +135,7 @@ class LocalCDXServer(IndexReader):
|
|||||||
class RemoteCDXServer(IndexReader):
|
class RemoteCDXServer(IndexReader):
|
||||||
"""
|
"""
|
||||||
>>> x = RemoteCDXServer('http://web.archive.org/cdx/search/cdx').load_cdx('example.com', parsed_cdx = True, limit = '2')
|
>>> x = RemoteCDXServer('http://web.archive.org/cdx/search/cdx').load_cdx('example.com', parsed_cdx = True, limit = '2')
|
||||||
>>> pprint(x[0].items())
|
>>> pprint(x.next().items())
|
||||||
[('urlkey', 'com,example)/'),
|
[('urlkey', 'com,example)/'),
|
||||||
('timestamp', '20020120142510'),
|
('timestamp', '20020120142510'),
|
||||||
('original', 'http://example.com:80/'),
|
('original', 'http://example.com:80/'),
|
||||||
@ -172,9 +172,9 @@ class RemoteCDXServer(IndexReader):
|
|||||||
raise e
|
raise e
|
||||||
|
|
||||||
if parsed_cdx:
|
if parsed_cdx:
|
||||||
return map(CDXCaptureResult, response)
|
return (CDXCaptureResult(cdx) for cdx in response)
|
||||||
else:
|
else:
|
||||||
return response
|
return iter(response)
|
||||||
|
|
||||||
|
|
||||||
# Note: this params are designed to make pywb compatible with the original Java wayback-cdx-server API:
|
# Note: this params are designed to make pywb compatible with the original Java wayback-cdx-server API:
|
||||||
@ -189,7 +189,7 @@ class RemoteCDXServer(IndexReader):
|
|||||||
return {
|
return {
|
||||||
|
|
||||||
wburl.QUERY:
|
wburl.QUERY:
|
||||||
{'collapseTime': collapseTime, 'filter': '!statuscode:(500|502|504)', 'limit': limit},
|
{'collapseTime': collapse_time, 'filter': '!statuscode:(500|502|504)', 'limit': limit},
|
||||||
|
|
||||||
wburl.URL_QUERY:
|
wburl.URL_QUERY:
|
||||||
{'collapse': 'urlkey', 'matchType': 'prefix', 'showGroupCount': True, 'showUniqCount': True, 'lastSkipTimestamp': True, 'limit': limit,
|
{'collapse': 'urlkey', 'matchType': 'prefix', 'showGroupCount': True, 'showUniqCount': True, 'lastSkipTimestamp': True, 'limit': limit,
|
||||||
@ -197,7 +197,7 @@ class RemoteCDXServer(IndexReader):
|
|||||||
},
|
},
|
||||||
|
|
||||||
wburl.REPLAY:
|
wburl.REPLAY:
|
||||||
{'sort': 'closest', 'filter': '!statuscode:(500|502|504)', 'limit': replayClosest, 'closest': wburl.timestamp, 'resolveRevisits': True},
|
{'sort': 'closest', 'filter': '!statuscode:(500|502|504)', 'limit': replay_closest, 'closest': wburl.timestamp, 'resolveRevisits': True},
|
||||||
|
|
||||||
# BUG: resolveRevisits currently doesn't work for this type of query
|
# BUG: resolveRevisits currently doesn't work for this type of query
|
||||||
# This is not an issue in archival mode, as there is a redirect to the actual timestamp query
|
# This is not an issue in archival mode, as there is a redirect to the actual timestamp query
|
||||||
|
Loading…
x
Reference in New Issue
Block a user