csu 2.6.14__tar.gz → 2.6.15__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.14 → csu-2.6.15}/.bumpversion.cfg +1 -1
- {csu-2.6.14 → csu-2.6.15}/.cookiecutterrc +1 -1
- {csu-2.6.14 → csu-2.6.15}/PKG-INFO +3 -3
- {csu-2.6.14 → csu-2.6.15}/README.rst +2 -2
- {csu-2.6.14 → csu-2.6.15}/pyproject.toml +1 -1
- {csu-2.6.14 → csu-2.6.15}/src/csu/__init__.py +1 -1
- {csu-2.6.14 → csu-2.6.15}/src/csu/service.py +33 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu.egg-info/PKG-INFO +3 -3
- {csu-2.6.14 → csu-2.6.15}/tests/test_service_auth.py +2 -1
- {csu-2.6.14 → csu-2.6.15}/.coveragerc +0 -0
- {csu-2.6.14 → csu-2.6.15}/.editorconfig +0 -0
- {csu-2.6.14 → csu-2.6.15}/.github/workflows/github-actions.yml +0 -0
- {csu-2.6.14 → csu-2.6.15}/.pre-commit-config.yaml +0 -0
- {csu-2.6.14 → csu-2.6.15}/.tombi.toml +0 -0
- {csu-2.6.14 → csu-2.6.15}/AUTHORS.rst +0 -0
- {csu-2.6.14 → csu-2.6.15}/CHANGELOG.rst +0 -0
- {csu-2.6.14 → csu-2.6.15}/CONTRIBUTING.rst +0 -0
- {csu-2.6.14 → csu-2.6.15}/LICENSE +0 -0
- {csu-2.6.14 → csu-2.6.15}/MANIFEST.in +0 -0
- {csu-2.6.14 → csu-2.6.15}/ci/bootstrap.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/ci/requirements.txt +0 -0
- {csu-2.6.14 → csu-2.6.15}/ci/templates/.github/workflows/github-actions.yml +0 -0
- {csu-2.6.14 → csu-2.6.15}/pytest.ini +0 -0
- {csu-2.6.14 → csu-2.6.15}/setup.cfg +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/admin.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/conf.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/consts.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/drf/__init__.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/drf/auth.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/drf/fields.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/drf/forms.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/drf/perms.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/drf/phonenumber.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/drf/serializers.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/drf/test_auth.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/drf/test_fields.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/drf/test_forms.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/drf/test_phonenumber.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/drf/test_serializers.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/drf/views.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/enums.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/env.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/exceptions.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/export.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/fixups.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/forms/__init__.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/forms/crispy.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/forms/fields.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/gettext.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/gettext_lazy.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/locale/ro/LC_MESSAGES/django.mo +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/locale/ro/LC_MESSAGES/django.po +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/logging.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/management.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/models.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/query.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/routers.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/templates/api_exception.html +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/templates/forms/widgets/opaquewidget.html +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/test_consts.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/test_env.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/test_management.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/test_service.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/test_timezones.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/test_utils.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/test_xml.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/timezones.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/utils.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/views.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/worker/__init__.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/worker/admin.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/worker/asgi.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/worker/engine.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/worker/enums.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/worker/job.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/worker/models.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/worker/registry.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/wsgi.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu/xml.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu.egg-info/SOURCES.txt +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu.egg-info/dependency_links.txt +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu.egg-info/requires.txt +0 -0
- {csu-2.6.14 → csu-2.6.15}/src/csu.egg-info/top_level.txt +0 -0
- {csu-2.6.14 → csu-2.6.15}/tests/cassettes/test_service/test_custom_context.yaml +0 -0
- {csu-2.6.14 → csu-2.6.15}/tests/cassettes/test_service/test_custom_context_0_retries.yaml +0 -0
- {csu-2.6.14 → csu-2.6.15}/tests/cassettes/test_service/test_decoding.yaml +0 -0
- {csu-2.6.14 → csu-2.6.15}/tests/cassettes/test_service/test_error.yaml +0 -0
- {csu-2.6.14 → csu-2.6.15}/tests/cassettes/test_service/test_logging.yaml +0 -0
- {csu-2.6.14 → csu-2.6.15}/tests/cassettes/test_service/test_redirects.yaml +0 -0
- {csu-2.6.14 → csu-2.6.15}/tests/cassettes/test_service_auth/test_async.yaml +0 -0
- {csu-2.6.14 → csu-2.6.15}/tests/cassettes/test_service_auth/test_async_auth.yaml +0 -0
- {csu-2.6.14 → csu-2.6.15}/tests/cassettes/test_service_auth/test_sync.yaml +0 -0
- {csu-2.6.14 → csu-2.6.15}/tests/cassettes/test_service_auth/test_sync_auth.yaml +0 -0
- {csu-2.6.14 → csu-2.6.15}/tests/conftest.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/tests/exampleworker.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/tests/test_exampleworker.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/tests/test_exceptions.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/tests/test_logging.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/tests/test_models.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/tests/test_service.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/tests/test_views.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/tests/test_worker.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/tests/testproject/__init__.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/tests/testproject/fixtures/testuser.json +0 -0
- {csu-2.6.14 → csu-2.6.15}/tests/testproject/models.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/tests/testproject/settings.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/tests/testproject/urls.py +0 -0
- {csu-2.6.14 → csu-2.6.15}/tox.ini +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: csu
|
|
3
|
-
Version: 2.6.
|
|
3
|
+
Version: 2.6.15
|
|
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.15.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.15...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.15.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.15...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/
|
|
@@ -17,6 +17,7 @@ from niquests import Session
|
|
|
17
17
|
from niquests.auth import AsyncAuthBase
|
|
18
18
|
from niquests.auth import AuthBase
|
|
19
19
|
from niquests.exceptions import ConnectionError
|
|
20
|
+
from niquests.structures import CaseInsensitiveDict
|
|
20
21
|
from niquests.typing import TLSClientCertType
|
|
21
22
|
from niquests.typing import TLSVerifyType
|
|
22
23
|
from urllib3.util import parse_url
|
|
@@ -42,6 +43,7 @@ from .logging import trim_auth_info
|
|
|
42
43
|
|
|
43
44
|
class HTTPServiceResponse:
|
|
44
45
|
status: int
|
|
46
|
+
headers: CaseInsensitiveDict[str, str]
|
|
45
47
|
http_response: Response | AsyncResponse
|
|
46
48
|
event_id: str
|
|
47
49
|
json: list | dict | None = None
|
|
@@ -51,6 +53,7 @@ class HTTPServiceResponse:
|
|
|
51
53
|
def __init__(self, http_response: Response, *, content: bytes, text: str, json=None, event_id=None):
|
|
52
54
|
assert http_response.status_code, f"{http_response=} doesn't have a status code"
|
|
53
55
|
self.status = http_response.status_code
|
|
56
|
+
self.headers = http_response.headers
|
|
54
57
|
self.http_response = http_response
|
|
55
58
|
self.event_id = event_id
|
|
56
59
|
self.content = content
|
|
@@ -465,6 +468,21 @@ class HTTPService[CT = HTTPServiceContext]:
|
|
|
465
468
|
return self.context_class(self, **self.context_defaults, **kwargs)
|
|
466
469
|
|
|
467
470
|
def auth(self, request: PreparedRequest, context: CT) -> PreparedRequest:
|
|
471
|
+
"""
|
|
472
|
+
Example::
|
|
473
|
+
|
|
474
|
+
def auth(self, request: PreparedRequest, context: HTTPServiceContext) -> PreparedRequest:
|
|
475
|
+
response = context.request("POST", "post", json={"foobar": 123}, auth=False)
|
|
476
|
+
assert response.json["json"] == {"foobar": 123}
|
|
477
|
+
request.headers["X-Auth"] = "123"
|
|
478
|
+
return request
|
|
479
|
+
|
|
480
|
+
Alternatively, if the auth is extremely simple you can just inject a builtin auth class::
|
|
481
|
+
|
|
482
|
+
def __init__(self, config):
|
|
483
|
+
super().__init__(config)
|
|
484
|
+
self.context_defaults = {"auth": HTTPDigestAuth(config['USERNAME'], config['password'])}
|
|
485
|
+
"""
|
|
468
486
|
return request
|
|
469
487
|
|
|
470
488
|
|
|
@@ -475,4 +493,19 @@ class AsyncHTTPService[ACT = AsyncHTTPServiceContext](HTTPService[ACT]):
|
|
|
475
493
|
return self.context_class(self, **self.context_defaults, **kwargs)
|
|
476
494
|
|
|
477
495
|
async def auth(self, request: PreparedRequest, context: ACT) -> PreparedRequest:
|
|
496
|
+
"""
|
|
497
|
+
Example::
|
|
498
|
+
|
|
499
|
+
async def auth(self, request: PreparedRequest, context: AsyncHTTPServiceContext) -> PreparedRequest:
|
|
500
|
+
response = await context.request("POST", "post", json={"foobar": 123}, auth=False)
|
|
501
|
+
assert response.json["json"] == {"foobar": 123}
|
|
502
|
+
request.headers["X-Auth"] = "123"
|
|
503
|
+
return request
|
|
504
|
+
|
|
505
|
+
Alternatively, if the auth is extremely simple you can just inject a builtin auth class::
|
|
506
|
+
|
|
507
|
+
def __init__(self, config):
|
|
508
|
+
super().__init__(config)
|
|
509
|
+
self.context_defaults = {"auth": HTTPDigestAuth(config['USERNAME'], config['password'])}
|
|
510
|
+
"""
|
|
478
511
|
return request
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: csu
|
|
3
|
-
Version: 2.6.
|
|
3
|
+
Version: 2.6.15
|
|
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.15.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.15...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/
|
|
@@ -7,6 +7,7 @@ from niquests.auth import HTTPBasicAuth
|
|
|
7
7
|
|
|
8
8
|
from csu.exceptions import UnexpectedStatusError
|
|
9
9
|
from csu.service import AsyncHTTPService
|
|
10
|
+
from csu.service import AsyncHTTPServiceContext
|
|
10
11
|
from csu.service import HTTPService
|
|
11
12
|
from csu.service import HTTPServiceContext
|
|
12
13
|
|
|
@@ -32,7 +33,7 @@ class AsyncAuthedService(AsyncHTTPService):
|
|
|
32
33
|
super().__init__(config={"BASE_URL": url, **config})
|
|
33
34
|
self.config = {"custom": "config"}
|
|
34
35
|
|
|
35
|
-
async def auth(self, request: PreparedRequest, context:
|
|
36
|
+
async def auth(self, request: PreparedRequest, context: AsyncHTTPServiceContext) -> PreparedRequest:
|
|
36
37
|
response = await context.request("POST", "post", json={"foobar": 123}, auth=False)
|
|
37
38
|
assert response.json["json"] == {"foobar": 123}
|
|
38
39
|
request.headers["X-Auth"] = "123"
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|