-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix
target_window
when redirect is > 1 day (#53)
The target_window parameter for `get_memento()` is supposed to limit how far off in time from the requested time you can get a memento for when the `exact` parameter is `False`. However, it only works correctly when the target is off by less than a day! (The scenarios we were originally concerned with in EDGI almost invariably were on the scale of a few hours, so I guess that's how this error snuck in.) If you set `exact=True` (the default), this bug wouldn’t be triggered. We were checking the target offset by the number of seconds, irrespective of the additional number of days involved. This fixes the issue by checking by total_seconds, which converts the days into seconds and includes them.
- Loading branch information
Showing
5 changed files
with
624 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
wayback/tests/cassettes/test_get_memento_raises_when_memento_is_outside_target_window
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
interactions: | ||
- request: | ||
body: null | ||
headers: | ||
Accept-Encoding: | ||
- gzip, deflate | ||
User-Agent: | ||
- wayback/0.2.4.post2.dev0+g0c2a63c (+https://github.com/edgi-govdata-archiving/wayback) | ||
method: GET | ||
uri: http://web.archive.org/web/20171101000000id_/https://www.fws.gov/birds/ | ||
response: | ||
body: | ||
string: '' | ||
headers: | ||
Connection: | ||
- keep-alive | ||
Content-Length: | ||
- '0' | ||
Content-Type: | ||
- text/plain; charset=utf-8 | ||
Date: | ||
- Mon, 19 Oct 2020 08:07:14 GMT | ||
Location: | ||
- http://web.archive.org/web/20171124151315id_/https://www.fws.gov/birds/ | ||
Server: | ||
- nginx/1.15.8 | ||
Server-Timing: | ||
- RedisCDXSource;dur=220.587665, PetaboxLoader3.resolve;dur=21.099726, exclusion.robots.policy;dur=0.321841, | ||
CDXLines.iter;dur=21.136237, LoadShardBlock;dur=1556.284805, captures_list;dur=1886.300549, | ||
PetaboxLoader3.datanode;dur=119.223321, esindex;dur=0.009743, exclusion.robots;dur=0.338801 | ||
X-App-Server: | ||
- wwwb-app13 | ||
X-Archive-Redirect-Reason: | ||
- found capture at 20171124151315 | ||
X-Archive-Screenname: | ||
- '0' | ||
X-Cache-Key: | ||
- httpweb.archive.org/web/20171101000000id_/https://www.fws.gov/birds/US | ||
X-Page-Cache: | ||
- HIT | ||
X-location: | ||
- All | ||
X-ts: | ||
- '302' | ||
status: | ||
code: 302 | ||
message: FOUND | ||
version: 1 |
Oops, something went wrong.