scim2-client 0.2.2__py3-none-any.whl → 0.3.1__py3-none-any.whl
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.
- scim2_client/__init__.py +4 -2
- scim2_client/client.py +556 -248
- scim2_client/engines/__init__.py +0 -0
- scim2_client/engines/httpx.py +430 -0
- scim2_client/engines/werkzeug.py +245 -0
- scim2_client/errors.py +6 -9
- {scim2_client-0.2.2.dist-info → scim2_client-0.3.1.dist-info}/METADATA +11 -7
- scim2_client-0.3.1.dist-info/RECORD +11 -0
- {scim2_client-0.2.2.dist-info → scim2_client-0.3.1.dist-info}/WHEEL +1 -1
- scim2_client-0.2.2.dist-info/RECORD +0 -8
- {scim2_client-0.2.2.dist-info → scim2_client-0.3.1.dist-info}/licenses/LICENSE.md +0 -0
scim2_client/errors.py
CHANGED
|
@@ -35,7 +35,7 @@ class RequestNetworkError(SCIMRequestError):
|
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
class RequestPayloadValidationError(SCIMRequestError):
|
|
38
|
-
"""Error raised when an invalid request payload has been passed to
|
|
38
|
+
"""Error raised when an invalid request payload has been passed to BaseSCIMClient.
|
|
39
39
|
|
|
40
40
|
This error is raised when a :class:`pydantic.ValidationError` has been caught
|
|
41
41
|
while validating the client request payload.
|
|
@@ -69,10 +69,9 @@ class SCIMResponseErrorObject(SCIMResponseError):
|
|
|
69
69
|
Those errors are only raised when the :code:`raise_scim_errors` parameter is :data:`True`.
|
|
70
70
|
"""
|
|
71
71
|
|
|
72
|
-
def __init__(self, *args, **kwargs):
|
|
72
|
+
def __init__(self, obj, *args, **kwargs):
|
|
73
73
|
message = kwargs.pop(
|
|
74
|
-
"message",
|
|
75
|
-
f"The server returned a SCIM Error object: {kwargs['source'].detail}",
|
|
74
|
+
"message", f"The server returned a SCIM Error object: {obj}"
|
|
76
75
|
)
|
|
77
76
|
super().__init__(message, *args, **kwargs)
|
|
78
77
|
|
|
@@ -80,10 +79,9 @@ class SCIMResponseErrorObject(SCIMResponseError):
|
|
|
80
79
|
class UnexpectedStatusCode(SCIMResponseError):
|
|
81
80
|
"""Error raised when a server returned an unexpected status code for a given :class:`~scim2_models.Context`."""
|
|
82
81
|
|
|
83
|
-
def __init__(self, *args, **kwargs):
|
|
82
|
+
def __init__(self, status_code: int, *args, **kwargs):
|
|
84
83
|
message = kwargs.pop(
|
|
85
|
-
"message",
|
|
86
|
-
f"Unexpected response status code: {kwargs['source'].status_code}",
|
|
84
|
+
"message", f"Unexpected response status code: {status_code}"
|
|
87
85
|
)
|
|
88
86
|
super().__init__(message, *args, **kwargs)
|
|
89
87
|
|
|
@@ -91,8 +89,7 @@ class UnexpectedStatusCode(SCIMResponseError):
|
|
|
91
89
|
class UnexpectedContentType(SCIMResponseError):
|
|
92
90
|
"""Error raised when a server returned an unexpected `Content-Type` header in a response."""
|
|
93
91
|
|
|
94
|
-
def __init__(self, *args, **kwargs):
|
|
95
|
-
content_type = kwargs["source"].headers.get("content-type", "")
|
|
92
|
+
def __init__(self, content_type, *args, **kwargs):
|
|
96
93
|
message = kwargs.pop("message", f"Unexpected content type: {content_type}")
|
|
97
94
|
super().__init__(message, *args, **kwargs)
|
|
98
95
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: scim2-client
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.1
|
|
4
4
|
Summary: Pythonically build SCIM requests and parse SCIM responses
|
|
5
5
|
Project-URL: documentation, https://scim2-client.readthedocs.io
|
|
6
6
|
Project-URL: repository, https://github.com/python-scim/scim2-client
|
|
@@ -222,15 +222,19 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
222
222
|
Classifier: Programming Language :: Python :: 3.13
|
|
223
223
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
224
224
|
Requires-Python: >=3.9
|
|
225
|
-
Requires-Dist: httpx>=0.24.0
|
|
226
225
|
Requires-Dist: scim2-models>=0.2.0
|
|
226
|
+
Provides-Extra: httpx
|
|
227
|
+
Requires-Dist: httpx>=0.28.0; extra == 'httpx'
|
|
228
|
+
Provides-Extra: werkzeug
|
|
229
|
+
Requires-Dist: werkzeug>=3.1.3; extra == 'werkzeug'
|
|
227
230
|
Description-Content-Type: text/markdown
|
|
228
231
|
|
|
229
232
|
# scim2-client
|
|
230
233
|
|
|
231
|
-
A SCIM client Python library built upon [scim2-models](https://scim2-models.readthedocs.io)
|
|
234
|
+
A SCIM client Python library built upon [scim2-models](https://scim2-models.readthedocs.io) ,
|
|
232
235
|
that pythonically build requests and parse responses,
|
|
233
236
|
following the [RFC7643](https://datatracker.ietf.org/doc/html/rfc7643.html) and [RFC7644](https://datatracker.ietf.org/doc/html/rfc7644.html) specifications.
|
|
237
|
+
You can use whatever request engine you prefer to perform network requests, but scim2-models comes with [httpx](https://github.com/encode/httpx) support.
|
|
234
238
|
|
|
235
239
|
It aims to be used in SCIM client applications, or in unit tests for SCIM server applications.
|
|
236
240
|
|
|
@@ -244,7 +248,7 @@ It allows users and groups creations, modifications and deletions to be synchron
|
|
|
244
248
|
## Installation
|
|
245
249
|
|
|
246
250
|
```shell
|
|
247
|
-
pip install scim2-client
|
|
251
|
+
pip install scim2-client[httpx]
|
|
248
252
|
```
|
|
249
253
|
|
|
250
254
|
## Usage
|
|
@@ -257,10 +261,10 @@ Here is an example of usage:
|
|
|
257
261
|
import datetime
|
|
258
262
|
from httpx import Client
|
|
259
263
|
from scim2_models import User, EnterpriseUser, Group, Error
|
|
260
|
-
from scim2_client import
|
|
264
|
+
from scim2_client.engines.httpx import SyncSCIMClient
|
|
261
265
|
|
|
262
|
-
client = Client(base_url=
|
|
263
|
-
scim =
|
|
266
|
+
client = Client(base_url="https://auth.example/scim/v2", headers={"Authorization": "Bearer foobar"})
|
|
267
|
+
scim = SyncSCIMClient(client, resource_types=(User[EnterpriseUser], Group))
|
|
264
268
|
|
|
265
269
|
# Query resources
|
|
266
270
|
user = scim.query(User[EnterpriseUser], "2819c223-7f76-453a-919d-413861904646")
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
scim2_client/__init__.py,sha256=KpNDJW9e2WseqSsQ6FltkQzemHM52NACfpJTd3eSIuY,853
|
|
2
|
+
scim2_client/client.py,sha256=CYZbkakM1dvcKO5wWMSRAMg2VfiYSI3_Ma7_fod169k,40159
|
|
3
|
+
scim2_client/errors.py,sha256=mxjUvarjvX3797w2NzdLqc6zxCQZlOga8cYABWpUAXM,4401
|
|
4
|
+
scim2_client/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
+
scim2_client/engines/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
+
scim2_client/engines/httpx.py,sha256=uqONJhFUdFf8W-GndL-mB_Z33FRuwgXAb2PczTB7wLg,16268
|
|
7
|
+
scim2_client/engines/werkzeug.py,sha256=9KcViIJVzSda6cpeiM-_dFjp5HFDBFkfiGRaUx4utrk,9107
|
|
8
|
+
scim2_client-0.3.1.dist-info/METADATA,sha256=uOKAfR90R1mbskVFqsLXvvyO-k0GclVt49ETK9WAiy4,16997
|
|
9
|
+
scim2_client-0.3.1.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
10
|
+
scim2_client-0.3.1.dist-info/licenses/LICENSE.md,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
11
|
+
scim2_client-0.3.1.dist-info/RECORD,,
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
scim2_client/__init__.py,sha256=vgrTJZIqJLZc72XCJwYKrSCGUDkMZTJjCJiZkHERZGs,780
|
|
2
|
-
scim2_client/client.py,sha256=CZutnTgabPAR4nxaztb-oUT8CjclBtyUgP4dAI-1u_Q,27427
|
|
3
|
-
scim2_client/errors.py,sha256=XH5e8zx3a1228GJjxugEgwO-shYAZWQx6LK_yZyX53E,4495
|
|
4
|
-
scim2_client/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
-
scim2_client-0.2.2.dist-info/METADATA,sha256=cOD8Ybin5JVFxUvIrJSXrSMyTqdsyAYfCe-NJdeIMbI,16742
|
|
6
|
-
scim2_client-0.2.2.dist-info/WHEEL,sha256=3U_NnUcV_1B1kPkYaPzN-irRckL5VW_lytn0ytO_kRY,87
|
|
7
|
-
scim2_client-0.2.2.dist-info/licenses/LICENSE.md,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
8
|
-
scim2_client-0.2.2.dist-info/RECORD,,
|
|
File without changes
|