scim2-client 0.2.2__py3-none-any.whl → 0.3.0__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/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 SCIMClient.
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.
@@ -72,7 +72,9 @@ class SCIMResponseErrorObject(SCIMResponseError):
72
72
  def __init__(self, *args, **kwargs):
73
73
  message = kwargs.pop(
74
74
  "message",
75
- f"The server returned a SCIM Error object: {kwargs['source'].detail}",
75
+ f"The server returned a SCIM Error object: {kwargs['source'].detail}"
76
+ if kwargs.get("source")
77
+ else "The server returned a SCIM Error object",
76
78
  )
77
79
  super().__init__(message, *args, **kwargs)
78
80
 
@@ -83,7 +85,9 @@ class UnexpectedStatusCode(SCIMResponseError):
83
85
  def __init__(self, *args, **kwargs):
84
86
  message = kwargs.pop(
85
87
  "message",
86
- f"Unexpected response status code: {kwargs['source'].status_code}",
88
+ f"Unexpected response status code: {kwargs['source'].status_code}"
89
+ if kwargs.get("source")
90
+ else "Unexpected response status code",
87
91
  )
88
92
  super().__init__(message, *args, **kwargs)
89
93
 
@@ -91,8 +95,7 @@ class UnexpectedStatusCode(SCIMResponseError):
91
95
  class UnexpectedContentType(SCIMResponseError):
92
96
  """Error raised when a server returned an unexpected `Content-Type` header in a response."""
93
97
 
94
- def __init__(self, *args, **kwargs):
95
- content_type = kwargs["source"].headers.get("content-type", "")
98
+ def __init__(self, content_type, *args, **kwargs):
96
99
  message = kwargs.pop("message", f"Unexpected content type: {content_type}")
97
100
  super().__init__(message, *args, **kwargs)
98
101
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: scim2-client
3
- Version: 0.2.2
3
+ Version: 0.3.0
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) and [httpx](https://github.com/encode/httpx),
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 SCIMClient
264
+ from scim2_client.engines.httpx import SyncSCIMClient
261
265
 
262
- client = Client(base_url=f"https://auth.example/scim/v2", headers={"Authorization": "Bearer foobar"})
263
- scim = SCIMClient(client, resource_types=(User[EnterpriseUser], Group))
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=CPXPqnmYNcXgn5ViPFpapI-oEg0oX8kXnwdWWmjm4eI,40130
3
+ scim2_client/errors.py,sha256=VDomHej2WH07up6a2wr7q0BVdj6RG4MyrM2t9UHx0Iw,4623
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.0.dist-info/METADATA,sha256=1aFhLfcE_1TXEI7iMjJUc8G99dmaViqJoN01BM8-_Rk,16997
9
+ scim2_client-0.3.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
10
+ scim2_client-0.3.0.dist-info/licenses/LICENSE.md,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
11
+ scim2_client-0.3.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.26.1
2
+ Generator: hatchling 1.26.3
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -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,,