Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Aug 6, 2023
1 parent 0953cd3 commit 9c9aa69
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion wlc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@ def process_error(self, error):

if status_code == 429:
headers = error.response.headers
raise WeblateThrottlingError(headers.get("X-RateLimit-Limit"), headers.get("Retry-After"))
raise WeblateThrottlingError(
headers.get("X-RateLimit-Limit"), headers.get("Retry-After")
)
if status_code == 404:
raise WeblateException(
"Object not found on the server "
Expand Down
6 changes: 5 additions & 1 deletion wlc/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,11 @@ def register_uris():
method=responses.POST,
json={"detail": "Can not create components"},
)
register_error("projects/throttled", 429, headers={"X-RateLimit-Limit": "100", "Retry-After": "81818"})
register_error(
"projects/throttled",
429,
headers={"X-RateLimit-Limit": "100", "Retry-After": "81818"},
)
register_error("projects/error", 500)
register_error("projects/io", 500, callback=raise_error)
register_error("projects/bug", 500, callback=raise_error)
Expand Down
2 changes: 1 addition & 1 deletion wlc/test_wlc.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def test_throttled(self):
"""Test listing projects."""
with self.assertRaisesRegex(
WeblateException,
"Throttling.*Limit is 100 requests. Retry after 81818 seconds."
"Throttling.*Limit is 100 requests. Retry after 81818 seconds.",
):
Weblate().get_object("throttled")

Expand Down

0 comments on commit 9c9aa69

Please sign in to comment.