Save pages returned by Save Page Now
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This is especially useful as pages freshly archived by SPN are not
immediately shown as available by the Wayback Machine API, so we
may send a pointless SPN request right after
This commit is contained in:
Val Lorentz 2022-09-24 22:43:34 +02:00
parent 8139bf5410
commit 1db60954d6
2 changed files with 7 additions and 1 deletions

View File

@ -157,4 +157,6 @@ class Session:
# If the Internet Archive does not have it yet, trigger its Save Code Now,
# and query the Wayback Machine again
return self._save_page_now(url)
snapshot = self._save_page_now(url)
self._db.add_web_page_snapshots([snapshot])
return snapshot

View File

@ -148,6 +148,8 @@ def test_get__uncached__recent_wb(configured_requests_mocker, opdb_db: Db):
content=b"Example page content from Wayback Machine",
)
assert snapshot == opdb_db.get_last_web_page_snapshot("http://example.org/")
assert [(r.method, r.url) for r in configured_requests_mocker.request_history] == [
(
"GET",
@ -214,6 +216,8 @@ def test_get__uncached__expired_wb(configured_requests_mocker, opdb_db: Db):
content=b"Example page content from Wayback Machine after Save Page Now",
)
assert snapshot == opdb_db.get_last_web_page_snapshot("http://example.org/")
assert [(r.method, r.url) for r in configured_requests_mocker.request_history] == [
(
"GET",