csu 2.6.15__tar.gz → 2.6.16__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {csu-2.6.15 → csu-2.6.16}/.bumpversion.cfg +1 -1
- {csu-2.6.15 → csu-2.6.16}/.cookiecutterrc +1 -1
- {csu-2.6.15 → csu-2.6.16}/.pre-commit-config.yaml +3 -3
- {csu-2.6.15 → csu-2.6.16}/PKG-INFO +3 -3
- {csu-2.6.15 → csu-2.6.16}/README.rst +2 -2
- {csu-2.6.15 → csu-2.6.16}/pyproject.toml +1 -1
- {csu-2.6.15 → csu-2.6.16}/src/csu/__init__.py +1 -1
- {csu-2.6.15 → csu-2.6.16}/src/csu/service.py +20 -15
- {csu-2.6.15 → csu-2.6.16}/src/csu.egg-info/PKG-INFO +3 -3
- {csu-2.6.15 → csu-2.6.16}/src/csu.egg-info/SOURCES.txt +1 -0
- csu-2.6.16/tests/cassettes/test_service/test_success.yaml +36 -0
- {csu-2.6.15 → csu-2.6.16}/tests/conftest.py +2 -0
- {csu-2.6.15 → csu-2.6.16}/tests/test_service.py +79 -46
- {csu-2.6.15 → csu-2.6.16}/tests/test_service_auth.py +4 -0
- {csu-2.6.15 → csu-2.6.16}/.coveragerc +0 -0
- {csu-2.6.15 → csu-2.6.16}/.editorconfig +0 -0
- {csu-2.6.15 → csu-2.6.16}/.github/workflows/github-actions.yml +0 -0
- {csu-2.6.15 → csu-2.6.16}/.tombi.toml +0 -0
- {csu-2.6.15 → csu-2.6.16}/AUTHORS.rst +0 -0
- {csu-2.6.15 → csu-2.6.16}/CHANGELOG.rst +0 -0
- {csu-2.6.15 → csu-2.6.16}/CONTRIBUTING.rst +0 -0
- {csu-2.6.15 → csu-2.6.16}/LICENSE +0 -0
- {csu-2.6.15 → csu-2.6.16}/MANIFEST.in +0 -0
- {csu-2.6.15 → csu-2.6.16}/ci/bootstrap.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/ci/requirements.txt +0 -0
- {csu-2.6.15 → csu-2.6.16}/ci/templates/.github/workflows/github-actions.yml +0 -0
- {csu-2.6.15 → csu-2.6.16}/pytest.ini +0 -0
- {csu-2.6.15 → csu-2.6.16}/setup.cfg +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/admin.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/conf.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/consts.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/drf/__init__.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/drf/auth.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/drf/fields.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/drf/forms.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/drf/perms.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/drf/phonenumber.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/drf/serializers.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/drf/test_auth.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/drf/test_fields.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/drf/test_forms.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/drf/test_phonenumber.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/drf/test_serializers.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/drf/views.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/enums.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/env.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/exceptions.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/export.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/fixups.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/forms/__init__.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/forms/crispy.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/forms/fields.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/gettext.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/gettext_lazy.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/locale/ro/LC_MESSAGES/django.mo +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/locale/ro/LC_MESSAGES/django.po +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/logging.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/management.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/models.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/query.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/routers.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/templates/api_exception.html +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/templates/forms/widgets/opaquewidget.html +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/test_consts.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/test_env.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/test_management.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/test_service.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/test_timezones.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/test_utils.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/test_xml.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/timezones.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/utils.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/views.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/worker/__init__.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/worker/admin.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/worker/asgi.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/worker/engine.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/worker/enums.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/worker/job.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/worker/models.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/worker/registry.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/wsgi.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu/xml.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu.egg-info/dependency_links.txt +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu.egg-info/requires.txt +0 -0
- {csu-2.6.15 → csu-2.6.16}/src/csu.egg-info/top_level.txt +0 -0
- {csu-2.6.15 → csu-2.6.16}/tests/cassettes/test_service/test_custom_context.yaml +0 -0
- {csu-2.6.15 → csu-2.6.16}/tests/cassettes/test_service/test_custom_context_0_retries.yaml +0 -0
- {csu-2.6.15 → csu-2.6.16}/tests/cassettes/test_service/test_decoding.yaml +0 -0
- {csu-2.6.15 → csu-2.6.16}/tests/cassettes/test_service/test_error.yaml +0 -0
- {csu-2.6.15 → csu-2.6.16}/tests/cassettes/test_service/test_logging.yaml +0 -0
- {csu-2.6.15 → csu-2.6.16}/tests/cassettes/test_service/test_redirects.yaml +0 -0
- {csu-2.6.15 → csu-2.6.16}/tests/cassettes/test_service_auth/test_async.yaml +0 -0
- {csu-2.6.15 → csu-2.6.16}/tests/cassettes/test_service_auth/test_async_auth.yaml +0 -0
- {csu-2.6.15 → csu-2.6.16}/tests/cassettes/test_service_auth/test_sync.yaml +0 -0
- {csu-2.6.15 → csu-2.6.16}/tests/cassettes/test_service_auth/test_sync_auth.yaml +0 -0
- {csu-2.6.15 → csu-2.6.16}/tests/exampleworker.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/tests/test_exampleworker.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/tests/test_exceptions.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/tests/test_logging.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/tests/test_models.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/tests/test_views.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/tests/test_worker.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/tests/testproject/__init__.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/tests/testproject/fixtures/testuser.json +0 -0
- {csu-2.6.15 → csu-2.6.16}/tests/testproject/models.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/tests/testproject/settings.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/tests/testproject/urls.py +0 -0
- {csu-2.6.15 → csu-2.6.16}/tox.ini +0 -0
|
@@ -6,19 +6,19 @@ exclude: '^(\.tox|ci/templates|\.bumpversion\.cfg)(/|$)'
|
|
|
6
6
|
# Note the order is intentional to avoid multiple passes of the hooks
|
|
7
7
|
repos:
|
|
8
8
|
- repo: https://github.com/adamchainz/django-upgrade
|
|
9
|
-
rev: 1.
|
|
9
|
+
rev: "1.33.0"
|
|
10
10
|
hooks:
|
|
11
11
|
- id: django-upgrade
|
|
12
12
|
args: [ --target-version, "5.2" ]
|
|
13
13
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
14
|
-
rev: v0.16.
|
|
14
|
+
rev: v0.16.10
|
|
15
15
|
hooks:
|
|
16
16
|
- id: ruff
|
|
17
17
|
# Using --unsafe-fixes can change code behavior
|
|
18
18
|
args: [--fix, --exit-non-zero-on-fix, --show-fixes, --unsafe-fixes]
|
|
19
19
|
- id: ruff-format
|
|
20
20
|
- repo: https://github.com/tombi-toml/tombi-pre-commit
|
|
21
|
-
rev: v1.
|
|
21
|
+
rev: v1.7.3
|
|
22
22
|
hooks:
|
|
23
23
|
- id: tombi-format
|
|
24
24
|
# args: [ "--offline" ]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: csu
|
|
3
|
-
Version: 2.6.
|
|
3
|
+
Version: 2.6.16
|
|
4
4
|
Summary: Clean Slate Utils - bunch of utility code, mostly Django/DRF specific.
|
|
5
5
|
Author-email: Ionel Cristian Mărieș <contact@ionelmc.ro>
|
|
6
6
|
License-Expression: BSD-2-Clause
|
|
@@ -69,9 +69,9 @@ Overview
|
|
|
69
69
|
.. |supported-implementations| image:: https://img.shields.io/pypi/implementation/csu.svg
|
|
70
70
|
:alt: Supported implementations
|
|
71
71
|
:target: https://pypi.org/project/csu
|
|
72
|
-
.. |commits-since| image:: https://img.shields.io/github/commits-since/ionelmc/python-csu/v2.6.
|
|
72
|
+
.. |commits-since| image:: https://img.shields.io/github/commits-since/ionelmc/python-csu/v2.6.16.svg
|
|
73
73
|
:alt: Commits since latest release
|
|
74
|
-
:target: https://github.com/ionelmc/python-csu/compare/v2.6.
|
|
74
|
+
:target: https://github.com/ionelmc/python-csu/compare/v2.6.16...main
|
|
75
75
|
.. |scrutinizer| image:: https://img.shields.io/scrutinizer/quality/g/ionelmc/python-csu/main.svg
|
|
76
76
|
:alt: Scrutinizer Status
|
|
77
77
|
:target: https://scrutinizer-ci.com/g/ionelmc/python-csu/
|
|
@@ -34,9 +34,9 @@ Overview
|
|
|
34
34
|
.. |supported-implementations| image:: https://img.shields.io/pypi/implementation/csu.svg
|
|
35
35
|
:alt: Supported implementations
|
|
36
36
|
:target: https://pypi.org/project/csu
|
|
37
|
-
.. |commits-since| image:: https://img.shields.io/github/commits-since/ionelmc/python-csu/v2.6.
|
|
37
|
+
.. |commits-since| image:: https://img.shields.io/github/commits-since/ionelmc/python-csu/v2.6.16.svg
|
|
38
38
|
:alt: Commits since latest release
|
|
39
|
-
:target: https://github.com/ionelmc/python-csu/compare/v2.6.
|
|
39
|
+
:target: https://github.com/ionelmc/python-csu/compare/v2.6.16...main
|
|
40
40
|
.. |scrutinizer| image:: https://img.shields.io/scrutinizer/quality/g/ionelmc/python-csu/main.svg
|
|
41
41
|
:alt: Scrutinizer Status
|
|
42
42
|
:target: https://scrutinizer-ci.com/g/ionelmc/python-csu/
|
|
@@ -3,7 +3,7 @@ from collections.abc import Iterable
|
|
|
3
3
|
from decimal import Decimal
|
|
4
4
|
from logging import Logger
|
|
5
5
|
from logging import getLogger
|
|
6
|
-
from
|
|
6
|
+
from time import time
|
|
7
7
|
from typing import Any
|
|
8
8
|
from typing import Self
|
|
9
9
|
from urllib.parse import urlunparse
|
|
@@ -102,6 +102,7 @@ class HTTPServiceContext[RTYPE = HTTPServiceResponse]:
|
|
|
102
102
|
log_response_text_limit = SERVICE_LOGGING_RESPONSE_TEXT_LIMIT
|
|
103
103
|
log_response_binary_limit = SERVICE_LOGGING_RESPONSE_BINARY_LIMIT
|
|
104
104
|
log_response_show_headers = SERVICE_LOGGING_RESPONSE_SHOW_HEADERS
|
|
105
|
+
start_time: float
|
|
105
106
|
|
|
106
107
|
def __init__(self, service: HTTPService[Self], event_id=None, auth=None, proxy=None, **kwargs):
|
|
107
108
|
if auth is None:
|
|
@@ -125,6 +126,7 @@ class HTTPServiceContext[RTYPE = HTTPServiceResponse]:
|
|
|
125
126
|
|
|
126
127
|
def __enter__(self) -> Self:
|
|
127
128
|
self.client.__enter__()
|
|
129
|
+
self.start_time = time()
|
|
128
130
|
return self
|
|
129
131
|
|
|
130
132
|
def log_request(self, request: PreparedRequest):
|
|
@@ -229,9 +231,9 @@ class HTTPServiceContext[RTYPE = HTTPServiceResponse]:
|
|
|
229
231
|
|
|
230
232
|
def handle_exit(self, exc_type, exc_val, exc_tb):
|
|
231
233
|
if exc_type is None:
|
|
232
|
-
|
|
234
|
+
self.logger.info("[%s] __exit__ in %.4fs", self.short_id, time() - self.start_time)
|
|
233
235
|
else:
|
|
234
|
-
self.logger.warning("[%s] __exit__ !> %r", self.short_id, exc_val)
|
|
236
|
+
self.logger.warning("[%s] __exit__ in %.4fs !> %r", self.short_id, time() - self.start_time, exc_val)
|
|
235
237
|
|
|
236
238
|
def handle_process_response(self, response: Response, *, expect_json: bool) -> RTYPE:
|
|
237
239
|
if expect_json:
|
|
@@ -260,17 +262,17 @@ class HTTPServiceContext[RTYPE = HTTPServiceResponse]:
|
|
|
260
262
|
request = Request(method=method, url=url, **kwargs, base_url=self.client.base_url)
|
|
261
263
|
return self.client.prepare_request(request)
|
|
262
264
|
|
|
263
|
-
def handle_retriable_failure(self, method, url, exc, retries_left, retry_budget):
|
|
265
|
+
def handle_retriable_failure(self, method: str, url, exc: Exception, retries_left: int, retry_budget: int, duration: float):
|
|
264
266
|
parsed_url = parse_url(url)
|
|
265
267
|
netloc = f"{parsed_url.host}:{parsed_url.port}" if parsed_url.port else parsed_url.host
|
|
266
268
|
clean_url = urlunparse((parsed_url.scheme, netloc, parsed_url.path, None, None, None))
|
|
267
269
|
if retries_left:
|
|
268
|
-
self.logger.error(f"[%s] %s {clean_url} !> %r (will retry %s more times)
|
|
270
|
+
self.logger.error(f"[%s] %s {clean_url} in %.4fs !> %r (will retry %s more times)", self.short_id, method, duration, exc, retries_left)
|
|
269
271
|
else:
|
|
270
272
|
if retry_budget:
|
|
271
|
-
self.logger.error(f"[%s] %s {clean_url} !> %r (exhausted retries)", self.short_id, method, exc)
|
|
273
|
+
self.logger.error(f"[%s] %s {clean_url} in %.4fs !> %r (exhausted retries)", self.short_id, method, duration, exc)
|
|
272
274
|
else:
|
|
273
|
-
self.logger.error(f"[%s] %s {clean_url} !> %r (no retry)", self.short_id, method, exc)
|
|
275
|
+
self.logger.error(f"[%s] %s {clean_url} in %.4fs !> %r (no retry)", self.short_id, method, duration, exc)
|
|
274
276
|
raise InternalServiceError(exc, event_id=self.event_id) from exc
|
|
275
277
|
|
|
276
278
|
def request(
|
|
@@ -310,8 +312,9 @@ class HTTPServiceContext[RTYPE = HTTPServiceResponse]:
|
|
|
310
312
|
proxy = proxy or self.proxy
|
|
311
313
|
proxies = {"http": proxy, "https": proxy} if proxy else {}
|
|
312
314
|
settings = self.client.merge_environment_settings(prepared_request.url, proxies, stream, verify, cert)
|
|
315
|
+
self.log_request(prepared_request)
|
|
316
|
+
send_time = time()
|
|
313
317
|
try:
|
|
314
|
-
self.log_request(prepared_request)
|
|
315
318
|
response = self.client.send(prepared_request, timeout=self.client.timeout, allow_redirects=follow_redirects, **settings)
|
|
316
319
|
if response.status_code in retry_statuses:
|
|
317
320
|
raise RetryableStatusError(response, accept_statuses, retry_statuses, event_id=self.event_id)
|
|
@@ -320,12 +323,12 @@ class HTTPServiceContext[RTYPE = HTTPServiceResponse]:
|
|
|
320
323
|
return self.handle_process_response(response, expect_json=expect_json)
|
|
321
324
|
except retry_exceptions as exc:
|
|
322
325
|
retry_failures.append(exc)
|
|
323
|
-
self.handle_retriable_failure(method, prepared_request.url, exc, retries_left, retry_budget)
|
|
326
|
+
self.handle_retriable_failure(method, prepared_request.url, exc, retries_left, retry_budget, time() - send_time)
|
|
324
327
|
except (InternalServiceError, OpenServiceError) as exc:
|
|
325
|
-
self.logger.warning("[%s] %s %s !>
|
|
328
|
+
self.logger.warning("[%s] %s %s in %.4fs !> %r", self.short_id, method, prepared_request.url, time() - send_time, exc)
|
|
326
329
|
raise
|
|
327
330
|
except Exception as exc:
|
|
328
|
-
self.logger.error("[%s] %s %s !> %r (not retryable)", self.short_id, method, prepared_request.url, exc)
|
|
331
|
+
self.logger.error("[%s] %s %s in %.4fs !> %r (not retryable)", self.short_id, method, prepared_request.url, time() - send_time, exc)
|
|
329
332
|
raise InternalServiceError(exc, event_id=self.event_id) from exc
|
|
330
333
|
else:
|
|
331
334
|
raise ExhaustedRetriesError(retry_budget, retry_failures, event_id=self.event_id)
|
|
@@ -339,6 +342,7 @@ class AsyncHTTPServiceContext[RTYPE = HTTPServiceResponse](HTTPServiceContext[RT
|
|
|
339
342
|
|
|
340
343
|
async def __aenter__(self) -> Self:
|
|
341
344
|
await self.client.__aenter__()
|
|
345
|
+
self.start_time = time()
|
|
342
346
|
return self
|
|
343
347
|
|
|
344
348
|
async def log_request(self, request: PreparedRequest):
|
|
@@ -415,8 +419,9 @@ class AsyncHTTPServiceContext[RTYPE = HTTPServiceResponse](HTTPServiceContext[RT
|
|
|
415
419
|
proxy = proxy or self.proxy
|
|
416
420
|
proxies = {"http": proxy, "https": proxy} if proxy else {}
|
|
417
421
|
settings = self.client.merge_environment_settings(prepared_request.url, proxies, stream, verify, cert)
|
|
422
|
+
await self.log_request(prepared_request)
|
|
423
|
+
send_time = time()
|
|
418
424
|
try:
|
|
419
|
-
await self.log_request(prepared_request)
|
|
420
425
|
response = await self.client.send(prepared_request, timeout=self.client.timeout, allow_redirects=follow_redirects, **settings)
|
|
421
426
|
if response.status_code in retry_statuses:
|
|
422
427
|
raise RetryableStatusError(response, accept_statuses, retry_statuses, event_id=self.event_id)
|
|
@@ -425,12 +430,12 @@ class AsyncHTTPServiceContext[RTYPE = HTTPServiceResponse](HTTPServiceContext[RT
|
|
|
425
430
|
return await self.handle_process_response(response, expect_json=expect_json)
|
|
426
431
|
except retry_exceptions as exc:
|
|
427
432
|
retry_failures.append(exc)
|
|
428
|
-
self.handle_retriable_failure(method, prepared_request.url, exc, retries_left, retry_budget)
|
|
433
|
+
self.handle_retriable_failure(method, prepared_request.url, exc, retries_left, retry_budget, time() - send_time)
|
|
429
434
|
except (InternalServiceError, OpenServiceError) as exc:
|
|
430
|
-
self.logger.warning("[%s] %s %s !>
|
|
435
|
+
self.logger.warning("[%s] %s %s in %.4fs !> %r", self.short_id, method, prepared_request.url, time() - send_time, exc)
|
|
431
436
|
raise
|
|
432
437
|
except Exception as exc:
|
|
433
|
-
self.logger.error("[%s] %s %s !> %r (not retryable)", self.short_id, method, prepared_request.url, exc)
|
|
438
|
+
self.logger.error("[%s] %s %s in %.4fs !> %r (not retryable)", self.short_id, method, prepared_request.url, time() - send_time, exc)
|
|
434
439
|
raise InternalServiceError(exc, event_id=self.event_id) from exc
|
|
435
440
|
else:
|
|
436
441
|
raise ExhaustedRetriesError(retry_budget, retry_failures, event_id=self.event_id)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: csu
|
|
3
|
-
Version: 2.6.
|
|
3
|
+
Version: 2.6.16
|
|
4
4
|
Summary: Clean Slate Utils - bunch of utility code, mostly Django/DRF specific.
|
|
5
5
|
Author-email: Ionel Cristian Mărieș <contact@ionelmc.ro>
|
|
6
6
|
License-Expression: BSD-2-Clause
|
|
@@ -69,9 +69,9 @@ Overview
|
|
|
69
69
|
.. |supported-implementations| image:: https://img.shields.io/pypi/implementation/csu.svg
|
|
70
70
|
:alt: Supported implementations
|
|
71
71
|
:target: https://pypi.org/project/csu
|
|
72
|
-
.. |commits-since| image:: https://img.shields.io/github/commits-since/ionelmc/python-csu/v2.6.
|
|
72
|
+
.. |commits-since| image:: https://img.shields.io/github/commits-since/ionelmc/python-csu/v2.6.16.svg
|
|
73
73
|
:alt: Commits since latest release
|
|
74
|
-
:target: https://github.com/ionelmc/python-csu/compare/v2.6.
|
|
74
|
+
:target: https://github.com/ionelmc/python-csu/compare/v2.6.16...main
|
|
75
75
|
.. |scrutinizer| image:: https://img.shields.io/scrutinizer/quality/g/ionelmc/python-csu/main.svg
|
|
76
76
|
:alt: Scrutinizer Status
|
|
77
77
|
:target: https://scrutinizer-ci.com/g/ionelmc/python-csu/
|
|
@@ -95,6 +95,7 @@ tests/cassettes/test_service/test_decoding.yaml
|
|
|
95
95
|
tests/cassettes/test_service/test_error.yaml
|
|
96
96
|
tests/cassettes/test_service/test_logging.yaml
|
|
97
97
|
tests/cassettes/test_service/test_redirects.yaml
|
|
98
|
+
tests/cassettes/test_service/test_success.yaml
|
|
98
99
|
tests/cassettes/test_service_auth/test_async.yaml
|
|
99
100
|
tests/cassettes/test_service_auth/test_async_auth.yaml
|
|
100
101
|
tests/cassettes/test_service_auth/test_sync.yaml
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
interactions:
|
|
2
|
+
- request:
|
|
3
|
+
body: null
|
|
4
|
+
headers:
|
|
5
|
+
Accept:
|
|
6
|
+
- '*/*'
|
|
7
|
+
Accept-Encoding:
|
|
8
|
+
- gzip, deflate, br
|
|
9
|
+
Connection:
|
|
10
|
+
- keep-alive
|
|
11
|
+
User-Agent:
|
|
12
|
+
- niquests/3.21.2
|
|
13
|
+
method: GET
|
|
14
|
+
uri: http://127.0.0.1:41507/status/200
|
|
15
|
+
response:
|
|
16
|
+
body:
|
|
17
|
+
string: ''
|
|
18
|
+
headers:
|
|
19
|
+
Access-Control-Allow-Credentials:
|
|
20
|
+
- 'true'
|
|
21
|
+
Access-Control-Allow-Origin:
|
|
22
|
+
- '*'
|
|
23
|
+
Connection:
|
|
24
|
+
- Close
|
|
25
|
+
Content-Length:
|
|
26
|
+
- '0'
|
|
27
|
+
Content-Type:
|
|
28
|
+
- text/html; charset=utf-8
|
|
29
|
+
Date:
|
|
30
|
+
- Fri, 09 Oct 2026 14:20:31 GMT
|
|
31
|
+
Server:
|
|
32
|
+
- Pytest-HTTPBIN/0.1.0
|
|
33
|
+
status:
|
|
34
|
+
code: 200
|
|
35
|
+
message: OK
|
|
36
|
+
version: 1
|
|
@@ -23,6 +23,7 @@ from vcr.request import Request
|
|
|
23
23
|
from vcr.stubs import VCRFakeSocket
|
|
24
24
|
|
|
25
25
|
from csu import exceptions
|
|
26
|
+
from csu import service
|
|
26
27
|
|
|
27
28
|
logger = getLogger(__name__)
|
|
28
29
|
|
|
@@ -55,6 +56,7 @@ def fake_accident_id(monkeypatch):
|
|
|
55
56
|
monkeypatch.setattr(exceptions, "now", lambda: datetime(2024, 12, 12)) # noqa: DTZ001
|
|
56
57
|
monkeypatch.setattr(exceptions, "urandom", fake_urandom)
|
|
57
58
|
monkeypatch.setattr(time, "perf_counter", lambda: 0)
|
|
59
|
+
monkeypatch.setattr(service, "time", lambda: 0.0)
|
|
58
60
|
monkeypatch.setattr(sessions, "preferred_clock", lambda: 0)
|
|
59
61
|
|
|
60
62
|
return SimpleNamespace(
|
|
@@ -122,7 +122,7 @@ def test_error_long(fake_accident_id, caplogs, httpbin):
|
|
|
122
122
|
) == snapshot(
|
|
123
123
|
[
|
|
124
124
|
"INFO | [&PID] Setting up BingoService with BASE_URL='[&HTTPBIN]' TIMEOUT=60 RETRIES=3 VERIFY=True",
|
|
125
|
-
'WARNING | [00001] __exit__ !> OkError("It\'s ok.", 1, event_id=PCC00001000)',
|
|
125
|
+
'WARNING | [00001] __exit__ in 0.0000s !> OkError("It\'s ok.", 1, event_id=PCC00001000)',
|
|
126
126
|
"""\
|
|
127
127
|
WARNING | (renderer: NoneType)
|
|
128
128
|
----------------------------------------------------------------- context ------------------------------------------------------------------
|
|
@@ -153,6 +153,60 @@ csu.exceptions.APIServiceError: {'accident_id': 'PCC00001000', 'detail': "It's o
|
|
|
153
153
|
)
|
|
154
154
|
|
|
155
155
|
|
|
156
|
+
@pytest.mark.vcr
|
|
157
|
+
def test_success(fake_accident_id, caplogs, httpbin):
|
|
158
|
+
bingo = BingoService(httpbin.url)
|
|
159
|
+
with bingo.context() as ctx:
|
|
160
|
+
resp = ctx.request("GET", "status/200", expect_json=False)
|
|
161
|
+
assert resp.status == 200
|
|
162
|
+
assert resp.headers == snapshot(
|
|
163
|
+
{
|
|
164
|
+
"Access-Control-Allow-Origin": "*",
|
|
165
|
+
"Connection": "Close",
|
|
166
|
+
"Content-Type": "text/html; charset=utf-8",
|
|
167
|
+
"Content-Length": "0",
|
|
168
|
+
"Access-Control-Allow-Credentials": "true",
|
|
169
|
+
"Date": "Fri, 09 Oct 2026 14:20:31 GMT",
|
|
170
|
+
"Server": "Pytest-HTTPBIN/0.1.0",
|
|
171
|
+
}
|
|
172
|
+
)
|
|
173
|
+
assert resp.content == snapshot(b"")
|
|
174
|
+
assert len(fake_accident_id.calls) == 1
|
|
175
|
+
assert fake_accident_id.calls[0].startswith("service.py:")
|
|
176
|
+
assert caplogs.get(
|
|
177
|
+
HTTPBIN=httpbin.url,
|
|
178
|
+
TEST_PATH=__file__,
|
|
179
|
+
PID=f"[pid:{getpid()}]",
|
|
180
|
+
) == snapshot(
|
|
181
|
+
[
|
|
182
|
+
"INFO | [&PID] Setting up BingoService with BASE_URL='[&HTTPBIN]' TIMEOUT=60 RETRIES=3 VERIFY=True",
|
|
183
|
+
"""\
|
|
184
|
+
INFO | [00001] GET [&HTTPBIN]/status/200
|
|
185
|
+
------------------------------------------------------------- request headers --------------------------------------------------------------
|
|
186
|
+
Accept: '*/*'
|
|
187
|
+
Accept-Encoding: 'gzip, deflate, br'
|
|
188
|
+
Connection: 'keep-alive'
|
|
189
|
+
User-Agent: 'niquests/3.21.2'\
|
|
190
|
+
""",
|
|
191
|
+
"""\
|
|
192
|
+
INFO | [00001] GET [&HTTPBIN]/status/200 => 200 in 0.0000s (HNone)
|
|
193
|
+
------------------------------------------------------------- response headers -------------------------------------------------------------
|
|
194
|
+
Access-Control-Allow-Credentials: 'true'
|
|
195
|
+
Access-Control-Allow-Origin: '*'
|
|
196
|
+
Connection: 'Close'
|
|
197
|
+
Content-Length: '0'
|
|
198
|
+
Content-Type: 'text/html; charset=utf-8'
|
|
199
|
+
Date: 'Fri, 09 Oct 2026 14:20:31 GMT'
|
|
200
|
+
Server: 'Pytest-HTTPBIN/0.1.0'
|
|
201
|
+
------------------------------------------- response body ('text/html; charset=utf-8' - 0 bytes) -------------------------------------------
|
|
202
|
+
b''
|
|
203
|
+
============================================================================================================================================\
|
|
204
|
+
""",
|
|
205
|
+
"INFO | [00001] __exit__ in 0.0000s",
|
|
206
|
+
]
|
|
207
|
+
)
|
|
208
|
+
|
|
209
|
+
|
|
156
210
|
@pytest.mark.vcr
|
|
157
211
|
def test_error(fake_accident_id, caplogs, httpbin):
|
|
158
212
|
bingo = BingoService(httpbin.url)
|
|
@@ -201,8 +255,8 @@ INFO | [00001] GET [&HTTPBIN]/status/599 => 599 in 0.0000s (HNone)
|
|
|
201
255
|
b''
|
|
202
256
|
============================================================================================================================================\
|
|
203
257
|
""",
|
|
204
|
-
"WARNING | [00001] GET [&HTTPBIN]/status/599 !>
|
|
205
|
-
"WARNING | [00001] __exit__ !> OkError(\"It's ok.\", UnexpectedStatusError('599 not in [200]', 599, b'', event_id=PCC00001000), event_id=PCC00001000)",
|
|
258
|
+
"WARNING | [00001] GET [&HTTPBIN]/status/599 in 0.0000s !> UnexpectedStatusError('599 not in [200]', 599, b'', event_id=PCC00001000)",
|
|
259
|
+
"WARNING | [00001] __exit__ in 0.0000s !> OkError(\"It's ok.\", UnexpectedStatusError('599 not in [200]', 599, b'', event_id=PCC00001000), event_id=PCC00001000)",
|
|
206
260
|
]
|
|
207
261
|
)
|
|
208
262
|
|
|
@@ -248,8 +302,8 @@ INFO | [00001] GET [&HTTPBIN]/status/418 => 418 in 0.0000s (HNone)
|
|
|
248
302
|
b'\\n -=[ teapot ]=-\\n\\n _...._\\n .\\' _ _ `.\\n | ."` ^ `". _,\\n \\\\_;`"---"`|//\\n | ;/\\n \\\\_ _/\\n `"""`\\n'
|
|
249
303
|
============================================================================================================================================\
|
|
250
304
|
''',
|
|
251
|
-
'WARNING | [00001] GET [&HTTPBIN]/status/418 !>
|
|
252
|
-
'WARNING | [00001] __exit__ !> DecodeError(JSONDecodeError(\'Expecting value: line 2 column 5 (char 5)\'), 418, b\'\\n -=[ teapot ]=-\\n\\n _...._\\n .\\\' _ _ `.\\n | ."` ^ `". _,\\n \\\\_;`"---"`|//\\n | ;/\\n \\\\_ _/\\n `"""`\\n\', event_id=PCC00001000)',
|
|
305
|
+
'WARNING | [00001] GET [&HTTPBIN]/status/418 in 0.0000s !> DecodeError(JSONDecodeError(\'Expecting value: line 2 column 5 (char 5)\'), 418, b\'\\n -=[ teapot ]=-\\n\\n _...._\\n .\\\' _ _ `.\\n | ."` ^ `". _,\\n \\\\_;`"---"`|//\\n | ;/\\n \\\\_ _/\\n `"""`\\n\', event_id=PCC00001000)',
|
|
306
|
+
'WARNING | [00001] __exit__ in 0.0000s !> DecodeError(JSONDecodeError(\'Expecting value: line 2 column 5 (char 5)\'), 418, b\'\\n -=[ teapot ]=-\\n\\n _...._\\n .\\\' _ _ `.\\n | ."` ^ `". _,\\n \\\\_;`"---"`|//\\n | ;/\\n \\\\_ _/\\n `"""`\\n\', event_id=PCC00001000)',
|
|
253
307
|
'''\
|
|
254
308
|
ERROR | (renderer: NoneType)
|
|
255
309
|
----------------------------------------------------------------- context ------------------------------------------------------------------
|
|
@@ -272,7 +326,7 @@ json.decoder.JSONDecodeError: Expecting value: line 2 column 5 (char 5)
|
|
|
272
326
|
During handling of the above exception, another exception occurred:
|
|
273
327
|
|
|
274
328
|
Traceback (most recent call last):
|
|
275
|
-
File "[&SERVICE_PATH]", line
|
|
329
|
+
File "[&SERVICE_PATH]", line 241, in handle_process_response
|
|
276
330
|
json = response.json(parse_float=Decimal)
|
|
277
331
|
File "[&MODELS_PATH]", line 1596, in json
|
|
278
332
|
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
|
|
@@ -281,16 +335,16 @@ niquests.exceptions.JSONDecodeError: Expecting value: line 2 column 5 (char 5)
|
|
|
281
335
|
The above exception was the direct cause of the following exception:
|
|
282
336
|
|
|
283
337
|
Traceback (most recent call last):
|
|
284
|
-
File "[&TEST_PATH]", line
|
|
338
|
+
File "[&TEST_PATH]", line 268, in test_decoding
|
|
285
339
|
bingo.json()
|
|
286
340
|
~~~~~~~~~~^^
|
|
287
341
|
File "[&TEST_PATH]", line 78, in json
|
|
288
342
|
return ctx.request("GET", "status/418", accept_statuses=[418]).json
|
|
289
343
|
~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
290
|
-
File "[&SERVICE_PATH]", line
|
|
344
|
+
File "[&SERVICE_PATH]", line 323, in request
|
|
291
345
|
return self.handle_process_response(response, expect_json=expect_json)
|
|
292
346
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
293
|
-
File "[&SERVICE_PATH]", line
|
|
347
|
+
File "[&SERVICE_PATH]", line 243, in handle_process_response
|
|
294
348
|
raise DecodeError(response, exc, event_id=self.event_id) from exc
|
|
295
349
|
csu.exceptions.DecodeError: DecodeError(JSONDecodeError('Expecting value: line 2 column 5 (char 5)'), response=<Response Dummy [418]>)
|
|
296
350
|
(418, b'\\n -=[ teapot ]=-\\n\\n _...._\\n .\\' _ _ `.\\n | ."` ^ `". _,\\n \\\\_;`"---"`|//\\n | ;/\\n \\\\_ _/\\n `"""`\\n')
|
|
@@ -341,8 +395,8 @@ INFO | [00001] GET [&HTTPBIN]/status/599 => 599 in 0.0000s (HNone)
|
|
|
341
395
|
b''
|
|
342
396
|
============================================================================================================================================\
|
|
343
397
|
""",
|
|
344
|
-
"WARNING | [00001] GET [&HTTPBIN]/status/599 !>
|
|
345
|
-
"WARNING | [00001] __exit__ !> OkError(\"It's ok.\", UnexpectedStatusError('599 not in [200]', 599, b'', event_id=PCC00001000), event_id=PCC00001000)",
|
|
398
|
+
"WARNING | [00001] GET [&HTTPBIN]/status/599 in 0.0000s !> UnexpectedStatusError('599 not in [200]', 599, b'', event_id=PCC00001000)",
|
|
399
|
+
"WARNING | [00001] __exit__ in 0.0000s !> OkError(\"It's ok.\", UnexpectedStatusError('599 not in [200]', 599, b'', event_id=PCC00001000), event_id=PCC00001000)",
|
|
346
400
|
"""\
|
|
347
401
|
WARNING | (renderer: NoneType)
|
|
348
402
|
----------------------------------------------------------------- context ------------------------------------------------------------------
|
|
@@ -352,7 +406,7 @@ Traceback (most recent call last):
|
|
|
352
406
|
File "[&TEST_PATH]", line 47, in error
|
|
353
407
|
return ctx.request("GET", "status/599", expect_json=False)
|
|
354
408
|
~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
355
|
-
File "[&SERVICE_PATH]", line
|
|
409
|
+
File "[&SERVICE_PATH]", line 322, in request
|
|
356
410
|
raise UnexpectedStatusError(response, accept_statuses, event_id=self.event_id)
|
|
357
411
|
csu.exceptions.UnexpectedStatusError: UnexpectedStatusError(<Response Dummy [599]>, accept_statuses=[200])
|
|
358
412
|
(599, b'')
|
|
@@ -360,7 +414,7 @@ csu.exceptions.UnexpectedStatusError: UnexpectedStatusError(<Response Dummy [599
|
|
|
360
414
|
The above exception was the direct cause of the following exception:
|
|
361
415
|
|
|
362
416
|
Traceback (most recent call last):
|
|
363
|
-
File "[&TEST_PATH]", line
|
|
417
|
+
File "[&TEST_PATH]", line 363, in test_logging
|
|
364
418
|
bingo.error()
|
|
365
419
|
~~~~~~~~~~~^^
|
|
366
420
|
File "[&TEST_PATH]", line 50, in error
|
|
@@ -549,14 +603,7 @@ INFO | [00001] POST [&HTTPBIN]/anything?foo=bar&accept_statuses=%7B999%7D&exp
|
|
|
549
603
|
b'{"args":{"accept_statuses":"{999}","expect_json":"true","follow_redirects":"false","foo":"bar","retries_left":"3","retry_count":"0","retry_statuses":"{200}"},"data":"config={\\'custom\\': \\'config\\'}","files":{},"form":{},"headers":{"Accept":"*/*","Accept-Encoding":"gzip, deflate, br","Connection":"keep-alive","Content-Length":"27","Host":"127.0.0.1:12345","User-Agent":"python-httpx/0.X.X"},"json":null,"method":"POST","origin":"127.0.0.1","url":"http://127.0.0.1:12345/anything?foo=bar&accept_statuses={999}&expect_json=true&follow_redirects=false&retries_left=3&retry_count=0&retry_statuses={200}"}\\n'
|
|
550
604
|
============================================================================================================================================\
|
|
551
605
|
""",
|
|
552
|
-
"""\
|
|
553
|
-
ERROR | [00001] POST [&HTTPBIN]/anything !> RetryableStatusError('200 not in [999] but in [200]', 200, b'{"args":{"accept_statuses":"{999}","expect_json":"true","follow_redirects":"false","foo":"bar","retries_left":"3","retry_count":"0","retry_statuses":"{200}"},"data":"config={\\'custom\\': \\'config\\'}","files":{},"form":{},"headers":{"Accept":"*/*","Accept-Encoding":"gzip, deflate, br","Connection":"keep-alive","Content-Length":"27","Host":"127.0.0.1:12345","User-Agent":"python-httpx/0.X.X"},"json":null,"method":"POST","origin":"127.0.0.1","url":"http://127.0.0.1:12345/anything?foo=bar&accept_statuses={999}&expect_json=true&follow_redirects=false&retries_left=3&retry_count=0&retry_statuses={200}"}\\n', event_id=PCC00001000) (will retry 3 more times)
|
|
554
|
-
Traceback (most recent call last):
|
|
555
|
-
File "[&SERVICE_PATH]", line 314, in request
|
|
556
|
-
raise RetryableStatusError(response, accept_statuses, retry_statuses, event_id=self.event_id)
|
|
557
|
-
csu.exceptions.RetryableStatusError: RetryableStatusError(<Response Dummy [200]>, accept_statuses=[999], retry_statuses=[200])
|
|
558
|
-
(200, b'{"args":{"accept_statuses":"{999}","expect_json":"true","follow_redirects":"false","foo":"bar","retries_left":"3","retry_count":"0","retry_statuses":"{200}"},"data":"config={\\'custom\\': \\'config\\'}","files":{},"form":{},"headers":{"Accept":"*/*","Accept-Encoding":"gzip, deflate, br","Connection":"keep-alive","Content-Length":"27","Host":"127.0.0.1:12345","User-Agent":"python-httpx/0.X.X"},"json":null,"method":"POST","origin":"127.0.0.1","url":"http://127.0.0.1:12345/anything?foo=bar&accept_statuses={999}&expect_json=true&follow_redirects=false&retries_left=3&retry_count=0&retry_statuses={200}"}\\n')
|
|
559
|
-
""",
|
|
606
|
+
'ERROR | [00001] POST [&HTTPBIN]/anything in 0.0000s !> RetryableStatusError(\'200 not in [999] but in [200]\', 200, b\'{"args":{"accept_statuses":"{999}","expect_json":"true","follow_redirects":"false","foo":"bar","retries_left":"3","retry_count":"0","retry_statuses":"{200}"},"data":"config={\\\'custom\\\': \\\'config\\\'}","files":{},"form":{},"headers":{"Accept":"*/*","Accept-Encoding":"gzip, deflate, br","Connection":"keep-alive","Content-Length":"27","Host":"127.0.0.1:12345","User-Agent":"python-httpx/0.X.X"},"json":null,"method":"POST","origin":"127.0.0.1","url":"http://127.0.0.1:12345/anything?foo=bar&accept_statuses={999}&expect_json=true&follow_redirects=false&retries_left=3&retry_count=0&retry_statuses={200}"}\\n\', event_id=PCC00001000) (will retry 3 more times)',
|
|
560
607
|
"""\
|
|
561
608
|
INFO | [00001] POST [&HTTPBIN]/anything?foo=bar&accept_statuses=%7B999%7D&expect_json=true&follow_redirects=false&retries_left=2&retry_count=1&retry_statuses=%7B200%7D
|
|
562
609
|
------------------------------------------------------------- request headers --------------------------------------------------------------
|
|
@@ -583,14 +630,7 @@ INFO | [00001] POST [&HTTPBIN]/anything?foo=bar&accept_statuses=%7B999%7D&exp
|
|
|
583
630
|
b'{"args":{"accept_statuses":"{999}","expect_json":"true","follow_redirects":"false","foo":"bar","retries_left":"2","retry_count":"1","retry_statuses":"{200}"},"data":"config={\\'custom\\': \\'config\\'}","files":{},"form":{},"headers":{"Accept":"*/*","Accept-Encoding":"gzip, deflate, br","Connection":"keep-alive","Content-Length":"27","Host":"127.0.0.1:12345","User-Agent":"python-httpx/0.X.X"},"json":null,"method":"POST","origin":"127.0.0.1","url":"http://127.0.0.1:12345/anything?foo=bar&accept_statuses={999}&expect_json=true&follow_redirects=false&retries_left=2&retry_count=1&retry_statuses={200}"}\\n'
|
|
584
631
|
============================================================================================================================================\
|
|
585
632
|
""",
|
|
586
|
-
"""\
|
|
587
|
-
ERROR | [00001] POST [&HTTPBIN]/anything !> RetryableStatusError('200 not in [999] but in [200]', 200, b'{"args":{"accept_statuses":"{999}","expect_json":"true","follow_redirects":"false","foo":"bar","retries_left":"2","retry_count":"1","retry_statuses":"{200}"},"data":"config={\\'custom\\': \\'config\\'}","files":{},"form":{},"headers":{"Accept":"*/*","Accept-Encoding":"gzip, deflate, br","Connection":"keep-alive","Content-Length":"27","Host":"127.0.0.1:12345","User-Agent":"python-httpx/0.X.X"},"json":null,"method":"POST","origin":"127.0.0.1","url":"http://127.0.0.1:12345/anything?foo=bar&accept_statuses={999}&expect_json=true&follow_redirects=false&retries_left=2&retry_count=1&retry_statuses={200}"}\\n', event_id=PCC00001000) (will retry 2 more times)
|
|
588
|
-
Traceback (most recent call last):
|
|
589
|
-
File "[&SERVICE_PATH]", line 314, in request
|
|
590
|
-
raise RetryableStatusError(response, accept_statuses, retry_statuses, event_id=self.event_id)
|
|
591
|
-
csu.exceptions.RetryableStatusError: RetryableStatusError(<Response Dummy [200]>, accept_statuses=[999], retry_statuses=[200])
|
|
592
|
-
(200, b'{"args":{"accept_statuses":"{999}","expect_json":"true","follow_redirects":"false","foo":"bar","retries_left":"2","retry_count":"1","retry_statuses":"{200}"},"data":"config={\\'custom\\': \\'config\\'}","files":{},"form":{},"headers":{"Accept":"*/*","Accept-Encoding":"gzip, deflate, br","Connection":"keep-alive","Content-Length":"27","Host":"127.0.0.1:12345","User-Agent":"python-httpx/0.X.X"},"json":null,"method":"POST","origin":"127.0.0.1","url":"http://127.0.0.1:12345/anything?foo=bar&accept_statuses={999}&expect_json=true&follow_redirects=false&retries_left=2&retry_count=1&retry_statuses={200}"}\\n')
|
|
593
|
-
""",
|
|
633
|
+
'ERROR | [00001] POST [&HTTPBIN]/anything in 0.0000s !> RetryableStatusError(\'200 not in [999] but in [200]\', 200, b\'{"args":{"accept_statuses":"{999}","expect_json":"true","follow_redirects":"false","foo":"bar","retries_left":"2","retry_count":"1","retry_statuses":"{200}"},"data":"config={\\\'custom\\\': \\\'config\\\'}","files":{},"form":{},"headers":{"Accept":"*/*","Accept-Encoding":"gzip, deflate, br","Connection":"keep-alive","Content-Length":"27","Host":"127.0.0.1:12345","User-Agent":"python-httpx/0.X.X"},"json":null,"method":"POST","origin":"127.0.0.1","url":"http://127.0.0.1:12345/anything?foo=bar&accept_statuses={999}&expect_json=true&follow_redirects=false&retries_left=2&retry_count=1&retry_statuses={200}"}\\n\', event_id=PCC00001000) (will retry 2 more times)',
|
|
594
634
|
"""\
|
|
595
635
|
INFO | [00001] POST [&HTTPBIN]/anything?foo=bar&accept_statuses=%7B999%7D&expect_json=true&follow_redirects=false&retries_left=1&retry_count=2&retry_statuses=%7B200%7D
|
|
596
636
|
------------------------------------------------------------- request headers --------------------------------------------------------------
|
|
@@ -617,14 +657,7 @@ INFO | [00001] POST [&HTTPBIN]/anything?foo=bar&accept_statuses=%7B999%7D&exp
|
|
|
617
657
|
b'{"args":{"accept_statuses":"{999}","expect_json":"true","follow_redirects":"false","foo":"bar","retries_left":"1","retry_count":"2","retry_statuses":"{200}"},"data":"config={\\'custom\\': \\'config\\'}","files":{},"form":{},"headers":{"Accept":"*/*","Accept-Encoding":"gzip, deflate, br","Connection":"keep-alive","Content-Length":"27","Host":"127.0.0.1:12345","User-Agent":"python-httpx/0.X.X"},"json":null,"method":"POST","origin":"127.0.0.1","url":"http://127.0.0.1:12345/anything?foo=bar&accept_statuses={999}&expect_json=true&follow_redirects=false&retries_left=1&retry_count=2&retry_statuses={200}"}\\n'
|
|
618
658
|
============================================================================================================================================\
|
|
619
659
|
""",
|
|
620
|
-
"""\
|
|
621
|
-
ERROR | [00001] POST [&HTTPBIN]/anything !> RetryableStatusError('200 not in [999] but in [200]', 200, b'{"args":{"accept_statuses":"{999}","expect_json":"true","follow_redirects":"false","foo":"bar","retries_left":"1","retry_count":"2","retry_statuses":"{200}"},"data":"config={\\'custom\\': \\'config\\'}","files":{},"form":{},"headers":{"Accept":"*/*","Accept-Encoding":"gzip, deflate, br","Connection":"keep-alive","Content-Length":"27","Host":"127.0.0.1:12345","User-Agent":"python-httpx/0.X.X"},"json":null,"method":"POST","origin":"127.0.0.1","url":"http://127.0.0.1:12345/anything?foo=bar&accept_statuses={999}&expect_json=true&follow_redirects=false&retries_left=1&retry_count=2&retry_statuses={200}"}\\n', event_id=PCC00001000) (will retry 1 more times)
|
|
622
|
-
Traceback (most recent call last):
|
|
623
|
-
File "[&SERVICE_PATH]", line 314, in request
|
|
624
|
-
raise RetryableStatusError(response, accept_statuses, retry_statuses, event_id=self.event_id)
|
|
625
|
-
csu.exceptions.RetryableStatusError: RetryableStatusError(<Response Dummy [200]>, accept_statuses=[999], retry_statuses=[200])
|
|
626
|
-
(200, b'{"args":{"accept_statuses":"{999}","expect_json":"true","follow_redirects":"false","foo":"bar","retries_left":"1","retry_count":"2","retry_statuses":"{200}"},"data":"config={\\'custom\\': \\'config\\'}","files":{},"form":{},"headers":{"Accept":"*/*","Accept-Encoding":"gzip, deflate, br","Connection":"keep-alive","Content-Length":"27","Host":"127.0.0.1:12345","User-Agent":"python-httpx/0.X.X"},"json":null,"method":"POST","origin":"127.0.0.1","url":"http://127.0.0.1:12345/anything?foo=bar&accept_statuses={999}&expect_json=true&follow_redirects=false&retries_left=1&retry_count=2&retry_statuses={200}"}\\n')
|
|
627
|
-
""",
|
|
660
|
+
'ERROR | [00001] POST [&HTTPBIN]/anything in 0.0000s !> RetryableStatusError(\'200 not in [999] but in [200]\', 200, b\'{"args":{"accept_statuses":"{999}","expect_json":"true","follow_redirects":"false","foo":"bar","retries_left":"1","retry_count":"2","retry_statuses":"{200}"},"data":"config={\\\'custom\\\': \\\'config\\\'}","files":{},"form":{},"headers":{"Accept":"*/*","Accept-Encoding":"gzip, deflate, br","Connection":"keep-alive","Content-Length":"27","Host":"127.0.0.1:12345","User-Agent":"python-httpx/0.X.X"},"json":null,"method":"POST","origin":"127.0.0.1","url":"http://127.0.0.1:12345/anything?foo=bar&accept_statuses={999}&expect_json=true&follow_redirects=false&retries_left=1&retry_count=2&retry_statuses={200}"}\\n\', event_id=PCC00001000) (will retry 1 more times)',
|
|
628
661
|
"""\
|
|
629
662
|
INFO | [00001] POST [&HTTPBIN]/anything?foo=bar&accept_statuses=%7B999%7D&expect_json=true&follow_redirects=false&retries_left=0&retry_count=3&retry_statuses=%7B200%7D
|
|
630
663
|
------------------------------------------------------------- request headers --------------------------------------------------------------
|
|
@@ -651,48 +684,48 @@ INFO | [00001] POST [&HTTPBIN]/anything?foo=bar&accept_statuses=%7B999%7D&exp
|
|
|
651
684
|
b'{"args":{"accept_statuses":"{999}","expect_json":"true","follow_redirects":"false","foo":"bar","retries_left":"0","retry_count":"3","retry_statuses":"{200}"},"data":"config={\\'custom\\': \\'config\\'}","files":{},"form":{},"headers":{"Accept":"*/*","Accept-Encoding":"gzip, deflate, br","Connection":"keep-alive","Content-Length":"27","Host":"127.0.0.1:12345","User-Agent":"python-httpx/0.X.X"},"json":null,"method":"POST","origin":"127.0.0.1","url":"http://127.0.0.1:12345/anything?foo=bar&accept_statuses={999}&expect_json=true&follow_redirects=false&retries_left=0&retry_count=3&retry_statuses={200}"}\\n'
|
|
652
685
|
============================================================================================================================================\
|
|
653
686
|
""",
|
|
654
|
-
'ERROR | [00001] POST [&HTTPBIN]/anything !> RetryableStatusError(\'200 not in [999] but in [200]\', 200, b\'{"args":{"accept_statuses":"{999}","expect_json":"true","follow_redirects":"false","foo":"bar","retries_left":"0","retry_count":"3","retry_statuses":"{200}"},"data":"config={\\\'custom\\\': \\\'config\\\'}","files":{},"form":{},"headers":{"Accept":"*/*","Accept-Encoding":"gzip, deflate, br","Connection":"keep-alive","Content-Length":"27","Host":"127.0.0.1:12345","User-Agent":"python-httpx/0.X.X"},"json":null,"method":"POST","origin":"127.0.0.1","url":"http://127.0.0.1:12345/anything?foo=bar&accept_statuses={999}&expect_json=true&follow_redirects=false&retries_left=0&retry_count=3&retry_statuses={200}"}\\n\', event_id=PCC00001000) (exhausted retries)',
|
|
655
|
-
'WARNING | [00001] __exit__ !> ExhaustedRetriesError(3, [RetryableStatusError(\'200 not in [999] but in [200]\', 200, b\'{"args":{"accept_statuses":"{999}","expect_json":"true","follow_redirects":"false","foo":"bar","retries_left":"3","retry_count":"0","retry_statuses":"{200}"},"data":"config={\\\'custom\\\': \\\'config\\\'}","files":{},"form":{},"headers":{"Accept":"*/*","Accept-Encoding":"gzip, deflate, br","Connection":"keep-alive","Content-Length":"27","Host":"127.0.0.1:12345","User-Agent":"python-httpx/0.X.X"},"json":null,"method":"POST","origin":"127.0.0.1","url":"http://127.0.0.1:12345/anything?foo=bar&accept_statuses={999}&expect_json=true&follow_redirects=false&retries_left=3&retry_count=0&retry_statuses={200}"}\\n\', event_id=PCC00001000), RetryableStatusError(\'200 not in [999] but in [200]\', 200, b\'{"args":{"accept_statuses":"{999}","expect_json":"true","follow_redirects":"false","foo":"bar","retries_left":"2","retry_count":"1","retry_statuses":"{200}"},"data":"config={\\\'custom\\\': \\\'config\\\'}","files":{},"form":{},"headers":{"Accept":"*/*","Accept-Encoding":"gzip, deflate, br","Connection":"keep-alive","Content-Length":"27","Host":"127.0.0.1:12345","User-Agent":"python-httpx/0.X.X"},"json":null,"method":"POST","origin":"127.0.0.1","url":"http://127.0.0.1:12345/anything?foo=bar&accept_statuses={999}&expect_json=true&follow_redirects=false&retries_left=2&retry_count=1&retry_statuses={200}"}\\n\', event_id=PCC00001000), RetryableStatusError(\'200 not in [999] but in [200]\', 200, b\'{"args":{"accept_statuses":"{999}","expect_json":"true","follow_redirects":"false","foo":"bar","retries_left":"1","retry_count":"2","retry_statuses":"{200}"},"data":"config={\\\'custom\\\': \\\'config\\\'}","files":{},"form":{},"headers":{"Accept":"*/*","Accept-Encoding":"gzip, deflate, br","Connection":"keep-alive","Content-Length":"27","Host":"127.0.0.1:12345","User-Agent":"python-httpx/0.X.X"},"json":null,"method":"POST","origin":"127.0.0.1","url":"http://127.0.0.1:12345/anything?foo=bar&accept_statuses={999}&expect_json=true&follow_redirects=false&retries_left=1&retry_count=2&retry_statuses={200}"}\\n\', event_id=PCC00001000), RetryableStatusError(\'200 not in [999] but in [200]\', 200, b\'{"args":{"accept_statuses":"{999}","expect_json":"true","follow_redirects":"false","foo":"bar","retries_left":"0","retry_count":"3","retry_statuses":"{200}"},"data":"config={\\\'custom\\\': \\\'config\\\'}","files":{},"form":{},"headers":{"Accept":"*/*","Accept-Encoding":"gzip, deflate, br","Connection":"keep-alive","Content-Length":"27","Host":"127.0.0.1:12345","User-Agent":"python-httpx/0.X.X"},"json":null,"method":"POST","origin":"127.0.0.1","url":"http://127.0.0.1:12345/anything?foo=bar&accept_statuses={999}&expect_json=true&follow_redirects=false&retries_left=0&retry_count=3&retry_statuses={200}"}\\n\', event_id=PCC00001000)], event_id=PCC00001000)',
|
|
687
|
+
'ERROR | [00001] POST [&HTTPBIN]/anything in 0.0000s !> RetryableStatusError(\'200 not in [999] but in [200]\', 200, b\'{"args":{"accept_statuses":"{999}","expect_json":"true","follow_redirects":"false","foo":"bar","retries_left":"0","retry_count":"3","retry_statuses":"{200}"},"data":"config={\\\'custom\\\': \\\'config\\\'}","files":{},"form":{},"headers":{"Accept":"*/*","Accept-Encoding":"gzip, deflate, br","Connection":"keep-alive","Content-Length":"27","Host":"127.0.0.1:12345","User-Agent":"python-httpx/0.X.X"},"json":null,"method":"POST","origin":"127.0.0.1","url":"http://127.0.0.1:12345/anything?foo=bar&accept_statuses={999}&expect_json=true&follow_redirects=false&retries_left=0&retry_count=3&retry_statuses={200}"}\\n\', event_id=PCC00001000) (exhausted retries)',
|
|
688
|
+
'WARNING | [00001] __exit__ in 0.0000s !> ExhaustedRetriesError(3, [RetryableStatusError(\'200 not in [999] but in [200]\', 200, b\'{"args":{"accept_statuses":"{999}","expect_json":"true","follow_redirects":"false","foo":"bar","retries_left":"3","retry_count":"0","retry_statuses":"{200}"},"data":"config={\\\'custom\\\': \\\'config\\\'}","files":{},"form":{},"headers":{"Accept":"*/*","Accept-Encoding":"gzip, deflate, br","Connection":"keep-alive","Content-Length":"27","Host":"127.0.0.1:12345","User-Agent":"python-httpx/0.X.X"},"json":null,"method":"POST","origin":"127.0.0.1","url":"http://127.0.0.1:12345/anything?foo=bar&accept_statuses={999}&expect_json=true&follow_redirects=false&retries_left=3&retry_count=0&retry_statuses={200}"}\\n\', event_id=PCC00001000), RetryableStatusError(\'200 not in [999] but in [200]\', 200, b\'{"args":{"accept_statuses":"{999}","expect_json":"true","follow_redirects":"false","foo":"bar","retries_left":"2","retry_count":"1","retry_statuses":"{200}"},"data":"config={\\\'custom\\\': \\\'config\\\'}","files":{},"form":{},"headers":{"Accept":"*/*","Accept-Encoding":"gzip, deflate, br","Connection":"keep-alive","Content-Length":"27","Host":"127.0.0.1:12345","User-Agent":"python-httpx/0.X.X"},"json":null,"method":"POST","origin":"127.0.0.1","url":"http://127.0.0.1:12345/anything?foo=bar&accept_statuses={999}&expect_json=true&follow_redirects=false&retries_left=2&retry_count=1&retry_statuses={200}"}\\n\', event_id=PCC00001000), RetryableStatusError(\'200 not in [999] but in [200]\', 200, b\'{"args":{"accept_statuses":"{999}","expect_json":"true","follow_redirects":"false","foo":"bar","retries_left":"1","retry_count":"2","retry_statuses":"{200}"},"data":"config={\\\'custom\\\': \\\'config\\\'}","files":{},"form":{},"headers":{"Accept":"*/*","Accept-Encoding":"gzip, deflate, br","Connection":"keep-alive","Content-Length":"27","Host":"127.0.0.1:12345","User-Agent":"python-httpx/0.X.X"},"json":null,"method":"POST","origin":"127.0.0.1","url":"http://127.0.0.1:12345/anything?foo=bar&accept_statuses={999}&expect_json=true&follow_redirects=false&retries_left=1&retry_count=2&retry_statuses={200}"}\\n\', event_id=PCC00001000), RetryableStatusError(\'200 not in [999] but in [200]\', 200, b\'{"args":{"accept_statuses":"{999}","expect_json":"true","follow_redirects":"false","foo":"bar","retries_left":"0","retry_count":"3","retry_statuses":"{200}"},"data":"config={\\\'custom\\\': \\\'config\\\'}","files":{},"form":{},"headers":{"Accept":"*/*","Accept-Encoding":"gzip, deflate, br","Connection":"keep-alive","Content-Length":"27","Host":"127.0.0.1:12345","User-Agent":"python-httpx/0.X.X"},"json":null,"method":"POST","origin":"127.0.0.1","url":"http://127.0.0.1:12345/anything?foo=bar&accept_statuses={999}&expect_json=true&follow_redirects=false&retries_left=0&retry_count=3&retry_statuses={200}"}\\n\', event_id=PCC00001000)], event_id=PCC00001000)',
|
|
656
689
|
"""\
|
|
657
690
|
ERROR | (renderer: NoneType)
|
|
658
691
|
----------------------------------------------------------------- context ------------------------------------------------------------------
|
|
659
692
|
{}
|
|
660
693
|
---------------------------------------------------------------- traceback -----------------------------------------------------------------
|
|
661
694
|
+ Exception Group Traceback (most recent call last):
|
|
662
|
-
| File "[&TEST_PATH]", line
|
|
695
|
+
| File "[&TEST_PATH]", line 501, in test_custom_context
|
|
663
696
|
| custom.run()
|
|
664
697
|
| ~~~~~~~~~~^^
|
|
665
|
-
| File "[&TEST_PATH]", line
|
|
698
|
+
| File "[&TEST_PATH]", line 484, in run
|
|
666
699
|
| resp = ctx.request(
|
|
667
700
|
| "POST",
|
|
668
701
|
| ...<6 lines>...
|
|
669
702
|
| accept_statuses=[999],
|
|
670
703
|
| )
|
|
671
|
-
| File "[&SERVICE_PATH]", line
|
|
704
|
+
| File "[&SERVICE_PATH]", line 334, in request
|
|
672
705
|
| raise ExhaustedRetriesError(retry_budget, retry_failures, event_id=self.event_id)
|
|
673
706
|
| csu.exceptions.ExhaustedRetriesError: ExhaustedRetriesError(3)
|
|
674
707
|
| ([RetryableStatusError('200 not in [999] but in [200]', 200, b'{"args":{"accept_statuses":"{999}","expect_json":"true","follow_redirects":"false","foo":"bar","retries_left":"3","retry_count":"0","retry_statuses":"{200}"},"data":"config={\\'custom\\': \\'config\\'}","files":{},"form":{},"headers":{"Accept":"*/*","Accept-Encoding":"gzip, deflate, br","Connection":"keep-alive","Content-Length":"27","Host":"127.0.0.1:12345","User-Agent":"python-httpx/0.X.X"},"json":null,"method":"POST","origin":"127.0.0.1","url":"http://127.0.0.1:12345/anything?foo=bar&accept_statuses={999}&expect_json=true&follow_redirects=false&retries_left=3&retry_count=0&retry_statuses={200}"}\\n', event_id=PCC00001000), RetryableStatusError('200 not in [999] but in [200]', 200, b'{"args":{"accept_statuses":"{999}","expect_json":"true","follow_redirects":"false","foo":"bar","retries_left":"2","retry_count":"1","retry_statuses":"{200}"},"data":"config={\\'custom\\': \\'config\\'}","files":{},"form":{},"headers":{"Accept":"*/*","Accept-Encoding":"gzip, deflate, br","Connection":"keep-alive","Content-Length":"27","Host":"127.0.0.1:12345","User-Agent":"python-httpx/0.X.X"},"json":null,"method":"POST","origin":"127.0.0.1","url":"http://127.0.0.1:12345/anything?foo=bar&accept_statuses={999}&expect_json=true&follow_redirects=false&retries_left=2&retry_count=1&retry_statuses={200}"}\\n', event_id=PCC00001000), RetryableStatusError('200 not in [999] but in [200]', 200, b'{"args":{"accept_statuses":"{999}","expect_json":"true","follow_redirects":"false","foo":"bar","retries_left":"1","retry_count":"2","retry_statuses":"{200}"},"data":"config={\\'custom\\': \\'config\\'}","files":{},"form":{},"headers":{"Accept":"*/*","Accept-Encoding":"gzip, deflate, br","Connection":"keep-alive","Content-Length":"27","Host":"127.0.0.1:12345","User-Agent":"python-httpx/0.X.X"},"json":null,"method":"POST","origin":"127.0.0.1","url":"http://127.0.0.1:12345/anything?foo=bar&accept_statuses={999}&expect_json=true&follow_redirects=false&retries_left=1&retry_count=2&retry_statuses={200}"}\\n', event_id=PCC00001000), RetryableStatusError('200 not in [999] but in [200]', 200, b'{"args":{"accept_statuses":"{999}","expect_json":"true","follow_redirects":"false","foo":"bar","retries_left":"0","retry_count":"3","retry_statuses":"{200}"},"data":"config={\\'custom\\': \\'config\\'}","files":{},"form":{},"headers":{"Accept":"*/*","Accept-Encoding":"gzip, deflate, br","Connection":"keep-alive","Content-Length":"27","Host":"127.0.0.1:12345","User-Agent":"python-httpx/0.X.X"},"json":null,"method":"POST","origin":"127.0.0.1","url":"http://127.0.0.1:12345/anything?foo=bar&accept_statuses={999}&expect_json=true&follow_redirects=false&retries_left=0&retry_count=3&retry_statuses={200}"}\\n', event_id=PCC00001000)],)
|
|
675
708
|
+-+---------------- 1 ----------------
|
|
676
709
|
| Traceback (most recent call last):
|
|
677
|
-
| File "[&SERVICE_PATH]", line
|
|
710
|
+
| File "[&SERVICE_PATH]", line 320, in request
|
|
678
711
|
| raise RetryableStatusError(response, accept_statuses, retry_statuses, event_id=self.event_id)
|
|
679
712
|
| csu.exceptions.RetryableStatusError: RetryableStatusError(<Response Dummy [200]>, accept_statuses=[999], retry_statuses=[200])
|
|
680
713
|
| (200, b'{"args":{"accept_statuses":"{999}","expect_json":"true","follow_redirects":"false","foo":"bar","retries_left":"3","retry_count":"0","retry_statuses":"{200}"},"data":"config={\\'custom\\': \\'config\\'}","files":{},"form":{},"headers":{"Accept":"*/*","Accept-Encoding":"gzip, deflate, br","Connection":"keep-alive","Content-Length":"27","Host":"127.0.0.1:12345","User-Agent":"python-httpx/0.X.X"},"json":null,"method":"POST","origin":"127.0.0.1","url":"http://127.0.0.1:12345/anything?foo=bar&accept_statuses={999}&expect_json=true&follow_redirects=false&retries_left=3&retry_count=0&retry_statuses={200}"}\\n')
|
|
681
714
|
+---------------- 2 ----------------
|
|
682
715
|
| Traceback (most recent call last):
|
|
683
|
-
| File "[&SERVICE_PATH]", line
|
|
716
|
+
| File "[&SERVICE_PATH]", line 320, in request
|
|
684
717
|
| raise RetryableStatusError(response, accept_statuses, retry_statuses, event_id=self.event_id)
|
|
685
718
|
| csu.exceptions.RetryableStatusError: RetryableStatusError(<Response Dummy [200]>, accept_statuses=[999], retry_statuses=[200])
|
|
686
719
|
| (200, b'{"args":{"accept_statuses":"{999}","expect_json":"true","follow_redirects":"false","foo":"bar","retries_left":"2","retry_count":"1","retry_statuses":"{200}"},"data":"config={\\'custom\\': \\'config\\'}","files":{},"form":{},"headers":{"Accept":"*/*","Accept-Encoding":"gzip, deflate, br","Connection":"keep-alive","Content-Length":"27","Host":"127.0.0.1:12345","User-Agent":"python-httpx/0.X.X"},"json":null,"method":"POST","origin":"127.0.0.1","url":"http://127.0.0.1:12345/anything?foo=bar&accept_statuses={999}&expect_json=true&follow_redirects=false&retries_left=2&retry_count=1&retry_statuses={200}"}\\n')
|
|
687
720
|
+---------------- 3 ----------------
|
|
688
721
|
| Traceback (most recent call last):
|
|
689
|
-
| File "[&SERVICE_PATH]", line
|
|
722
|
+
| File "[&SERVICE_PATH]", line 320, in request
|
|
690
723
|
| raise RetryableStatusError(response, accept_statuses, retry_statuses, event_id=self.event_id)
|
|
691
724
|
| csu.exceptions.RetryableStatusError: RetryableStatusError(<Response Dummy [200]>, accept_statuses=[999], retry_statuses=[200])
|
|
692
725
|
| (200, b'{"args":{"accept_statuses":"{999}","expect_json":"true","follow_redirects":"false","foo":"bar","retries_left":"1","retry_count":"2","retry_statuses":"{200}"},"data":"config={\\'custom\\': \\'config\\'}","files":{},"form":{},"headers":{"Accept":"*/*","Accept-Encoding":"gzip, deflate, br","Connection":"keep-alive","Content-Length":"27","Host":"127.0.0.1:12345","User-Agent":"python-httpx/0.X.X"},"json":null,"method":"POST","origin":"127.0.0.1","url":"http://127.0.0.1:12345/anything?foo=bar&accept_statuses={999}&expect_json=true&follow_redirects=false&retries_left=1&retry_count=2&retry_statuses={200}"}\\n')
|
|
693
726
|
+---------------- 4 ----------------
|
|
694
727
|
| Traceback (most recent call last):
|
|
695
|
-
| File "[&SERVICE_PATH]", line
|
|
728
|
+
| File "[&SERVICE_PATH]", line 320, in request
|
|
696
729
|
| raise RetryableStatusError(response, accept_statuses, retry_statuses, event_id=self.event_id)
|
|
697
730
|
| csu.exceptions.RetryableStatusError: RetryableStatusError(<Response Dummy [200]>, accept_statuses=[999], retry_statuses=[200])
|
|
698
731
|
| (200, b'{"args":{"accept_statuses":"{999}","expect_json":"true","follow_redirects":"false","foo":"bar","retries_left":"0","retry_count":"3","retry_statuses":"{200}"},"data":"config={\\'custom\\': \\'config\\'}","files":{},"form":{},"headers":{"Accept":"*/*","Accept-Encoding":"gzip, deflate, br","Connection":"keep-alive","Content-Length":"27","Host":"127.0.0.1:12345","User-Agent":"python-httpx/0.X.X"},"json":null,"method":"POST","origin":"127.0.0.1","url":"http://127.0.0.1:12345/anything?foo=bar&accept_statuses={999}&expect_json=true&follow_redirects=false&retries_left=0&retry_count=3&retry_statuses={200}"}\\n')
|
|
@@ -97,6 +97,7 @@ INFO | [00001] GET http://[&HTTPBIN]/basic-auth/usr/pwd => 200 in 0.0000s (HN
|
|
|
97
97
|
b'{\\n "authenticated": true,\\n "user": "usr"\\n}\\n'
|
|
98
98
|
============================================================================================================================================\
|
|
99
99
|
""",
|
|
100
|
+
"INFO | [00001] __exit__ in 0.0000s",
|
|
100
101
|
]
|
|
101
102
|
)
|
|
102
103
|
with pytest.raises(UnexpectedStatusError):
|
|
@@ -138,6 +139,7 @@ INFO | [00001] GET http://[&HTTPBIN]/basic-auth/usr/pwd => 200 in 0.0000s (H0
|
|
|
138
139
|
b'{\\n "authenticated": true,\\n "user": "usr"\\n}\\n'
|
|
139
140
|
============================================================================================================================================\
|
|
140
141
|
""",
|
|
142
|
+
"INFO | [00001] __exit__ in 0.0000s",
|
|
141
143
|
]
|
|
142
144
|
)
|
|
143
145
|
with pytest.raises(UnexpectedStatusError):
|
|
@@ -204,6 +206,7 @@ INFO | [00001] GET http://[&HTTPBIN]/json => 200 in 0.0000s (HNone)
|
|
|
204
206
|
b'{"slideshow":{"author":"Yours Truly","date":"date of publication","slides":[{"title":"Wake up to WonderWidgets!","type":"all"},{"items":["Why <em>WonderWidgets</em> are great","Who <em>buys</em> WonderWidgets"],"title":"Overview","type":"all"}],"title":"Sample Slide Show"}}\\n'
|
|
205
207
|
============================================================================================================================================\
|
|
206
208
|
""",
|
|
209
|
+
"INFO | [00001] __exit__ in 0.0000s",
|
|
207
210
|
]
|
|
208
211
|
)
|
|
209
212
|
|
|
@@ -271,5 +274,6 @@ INFO | [00001] GET [&HTTPBIN]/json => 200 in 0.0000s (H0)
|
|
|
271
274
|
b'{"slideshow":{"author":"Yours Truly","date":"date of publication","slides":[{"title":"Wake up to WonderWidgets!","type":"all"},{"items":["Why <em>WonderWidgets</em> are great","Who <em>buys</em> WonderWidgets"],"title":"Overview","type":"all"}],"title":"Sample Slide Show"}}\\n'
|
|
272
275
|
============================================================================================================================================\
|
|
273
276
|
""",
|
|
277
|
+
"INFO | [00001] __exit__ in 0.0000s",
|
|
274
278
|
]
|
|
275
279
|
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|