scim2-client 0.7.1__py3-none-any.whl → 0.7.3__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/client.py
CHANGED
|
@@ -290,8 +290,6 @@ class SCIMClient:
|
|
|
290
290
|
if raise_scim_errors is None:
|
|
291
291
|
raise_scim_errors = self.raise_scim_errors
|
|
292
292
|
|
|
293
|
-
self._check_content_types(headers)
|
|
294
|
-
|
|
295
293
|
# In addition to returning an HTTP response code, implementers MUST return
|
|
296
294
|
# the errors in the body of the response in a JSON format
|
|
297
295
|
# https://datatracker.ietf.org/doc/html/rfc7644.html#section-3.12
|
|
@@ -301,6 +299,7 @@ class SCIMClient:
|
|
|
301
299
|
response_payload = None
|
|
302
300
|
|
|
303
301
|
else:
|
|
302
|
+
self._check_content_types(headers)
|
|
304
303
|
response_payload = payload
|
|
305
304
|
|
|
306
305
|
if check_response_payload is None:
|
|
@@ -313,7 +312,7 @@ class SCIMClient:
|
|
|
313
312
|
if response_payload and response_payload.get("schemas") == [Error.__schema__]:
|
|
314
313
|
error = Error.model_validate(response_payload)
|
|
315
314
|
if raise_scim_errors:
|
|
316
|
-
raise SCIMResponseErrorObject(
|
|
315
|
+
raise SCIMResponseErrorObject(error)
|
|
317
316
|
return error
|
|
318
317
|
|
|
319
318
|
self._check_status_codes(status_code, expected_status_codes)
|
scim2_client/errors.py
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
from typing import TYPE_CHECKING
|
|
1
2
|
from typing import Any
|
|
2
3
|
|
|
4
|
+
if TYPE_CHECKING:
|
|
5
|
+
from scim2_models import Error
|
|
6
|
+
|
|
3
7
|
|
|
4
8
|
class SCIMClientError(Exception):
|
|
5
9
|
"""Base exception for scim2-client.
|
|
@@ -69,14 +73,24 @@ class SCIMResponseErrorObject(SCIMResponseError):
|
|
|
69
73
|
"""The server response returned a :class:`scim2_models.Error` object.
|
|
70
74
|
|
|
71
75
|
Those errors are only raised when the :code:`raise_scim_errors` parameter is :data:`True`.
|
|
76
|
+
|
|
77
|
+
:param error: The :class:`~scim2_models.Error` object returned by the server.
|
|
72
78
|
"""
|
|
73
79
|
|
|
74
|
-
def __init__(self,
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
80
|
+
def __init__(self, error: "Error", *args: Any, **kwargs: Any) -> None:
|
|
81
|
+
self._error = error
|
|
82
|
+
parts = []
|
|
83
|
+
if error.scim_type:
|
|
84
|
+
parts.append(error.scim_type + ":")
|
|
85
|
+
if error.detail:
|
|
86
|
+
parts.append(error.detail)
|
|
87
|
+
message = " ".join(parts) if parts else "SCIM Error"
|
|
78
88
|
super().__init__(message, *args, **kwargs)
|
|
79
89
|
|
|
90
|
+
def to_error(self) -> "Error":
|
|
91
|
+
"""Return the :class:`~scim2_models.Error` object returned by the server."""
|
|
92
|
+
return self._error
|
|
93
|
+
|
|
80
94
|
|
|
81
95
|
class UnexpectedStatusCode(SCIMResponseError):
|
|
82
96
|
"""Error raised when a server returned an unexpected status code for a given :class:`~scim2_models.Context`."""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: scim2-client
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.3
|
|
4
4
|
Summary: Pythonically build SCIM requests and parse SCIM responses
|
|
5
5
|
Keywords: scim,scim2,provisioning,rfc7643,rfc7644,httpx,api
|
|
6
6
|
Author: Yaal Coop
|
|
@@ -246,6 +246,17 @@ Provisioning is the action of managing a set of resources across different servi
|
|
|
246
246
|
SCIM is often used between Identity Providers and applications in completion of standards like OAuth2 and OpenID Connect.
|
|
247
247
|
It allows users and groups creations, modifications and deletions to be synchronized between applications.
|
|
248
248
|
|
|
249
|
+
## Features
|
|
250
|
+
|
|
251
|
+
- **CRUD Operations**: `create`, `query`, `replace`, `delete` methods for SCIM resources
|
|
252
|
+
- **PATCH Support**: Partial resource modifications with `add`, `remove` and `replace` operations
|
|
253
|
+
- **Server Discovery**: Automatic retrieval of `ServiceProviderConfig`, `ResourceTypes` and `Schemas`
|
|
254
|
+
- **Search & Filtering**: Support for SCIM filters, sorting, pagination and attribute selection
|
|
255
|
+
- **Sync & Async**: Both synchronous and asynchronous clients available
|
|
256
|
+
- **Multiple HTTP Engines**: Built-in support for [httpx](https://github.com/encode/httpx) (sync/async) and [werkzeug](https://werkzeug.palletsprojects.com/) (testing). Adaptable to any network engine.
|
|
257
|
+
- **Request & Response Validation**: Automatic payload validation against SCIM schemas
|
|
258
|
+
- **Error Handling**: Structured exceptions for network, request and response errors
|
|
259
|
+
|
|
249
260
|
## Installation
|
|
250
261
|
|
|
251
262
|
```shell
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
scim2_client/__init__.py,sha256=l0pyBLiTpFA68ao98PqQLT_Xx0mw8BHumwrIHYCWa_M,845
|
|
2
|
-
scim2_client/client.py,sha256=
|
|
2
|
+
scim2_client/client.py,sha256=F1bBtKKQFQHUJv5sVqxEvLqR0velIEVhGVLIJ22WL8k,54362
|
|
3
3
|
scim2_client/engines/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
4
|
scim2_client/engines/httpx.py,sha256=mO7nVoq9-M9OndVnSP8tGaXzKy89Tbn5VGsob_0gn04,20034
|
|
5
5
|
scim2_client/engines/werkzeug.py,sha256=Pysdjvj_v3e-mvDhED6mJUmpTCP9yMYMZW02JrW36UY,11994
|
|
6
|
-
scim2_client/errors.py,sha256=
|
|
6
|
+
scim2_client/errors.py,sha256=J3VQti05Jq8le3_AHghOfjAtTqUVGvnBTAkLbIP-GoM,5031
|
|
7
7
|
scim2_client/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
-
scim2_client-0.7.
|
|
9
|
-
scim2_client-0.7.
|
|
10
|
-
scim2_client-0.7.
|
|
8
|
+
scim2_client-0.7.3.dist-info/WHEEL,sha256=eh7sammvW2TypMMMGKgsM83HyA_3qQ5Lgg3ynoecH3M,79
|
|
9
|
+
scim2_client-0.7.3.dist-info/METADATA,sha256=ERQkceOtdw0VU0g-oo-QZaw1OdCQ7bkgpL5ifrnLqFg,18028
|
|
10
|
+
scim2_client-0.7.3.dist-info/RECORD,,
|
|
File without changes
|