-
Notifications
You must be signed in to change notification settings - Fork 636
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #479 from geopy/add-rate-limited-exc
Add `GeocoderRateLimited` error, raise it for 429 instead of `GeocoderQuotaExceeded`
- Loading branch information
Showing
16 changed files
with
253 additions
and
47 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
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
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
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
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
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import datetime | ||
import time | ||
from unittest.mock import patch | ||
|
||
import pytest | ||
|
||
from geopy.adapters import get_retry_after | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"headers, expected_retry_after", | ||
[ | ||
({}, None), | ||
({"retry-after": "42"}, 42), | ||
({"retry-after": "Wed, 21 Oct 2015 07:28:44 GMT"}, 43), | ||
({"retry-after": "Wed, 21 Oct 2015 06:28:44 GMT"}, 0), | ||
({"retry-after": "Wed"}, None), | ||
], | ||
) | ||
def test_get_retry_after(headers, expected_retry_after): | ||
current_time = datetime.datetime( | ||
2015, 10, 21, 7, 28, 1, tzinfo=datetime.timezone.utc | ||
).timestamp() | ||
with patch.object(time, "time", return_value=current_time): | ||
assert expected_retry_after == get_retry_after(headers) |
Oops, something went wrong.