scim2-client 0.1.10__tar.gz → 0.2.0__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.
- {scim2_client-0.1.10 → scim2_client-0.2.0}/PKG-INFO +1 -1
- {scim2_client-0.1.10 → scim2_client-0.2.0}/pyproject.toml +1 -1
- {scim2_client-0.1.10 → scim2_client-0.2.0}/scim2_client/client.py +30 -32
- {scim2_client-0.1.10 → scim2_client-0.2.0}/README.md +0 -0
- {scim2_client-0.1.10 → scim2_client-0.2.0}/scim2_client/__init__.py +0 -0
- {scim2_client-0.1.10 → scim2_client-0.2.0}/scim2_client/errors.py +0 -0
|
@@ -163,7 +163,7 @@ class SCIMClient:
|
|
|
163
163
|
expected_status_codes: List[int],
|
|
164
164
|
expected_types: Optional[Type] = None,
|
|
165
165
|
check_response_payload: bool = True,
|
|
166
|
-
raise_scim_errors: bool =
|
|
166
|
+
raise_scim_errors: bool = True,
|
|
167
167
|
scim_ctx: Optional[Context] = None,
|
|
168
168
|
):
|
|
169
169
|
if expected_status_codes and response.status_code not in expected_status_codes:
|
|
@@ -176,7 +176,10 @@ class SCIMClient:
|
|
|
176
176
|
# https://datatracker.ietf.org/doc/html/rfc7644.html#section-8.1
|
|
177
177
|
|
|
178
178
|
expected_response_content_types = ("application/scim+json", "application/json")
|
|
179
|
-
if
|
|
179
|
+
if (
|
|
180
|
+
response.headers.get("content-type").split(";").pop(0)
|
|
181
|
+
not in expected_response_content_types
|
|
182
|
+
):
|
|
180
183
|
raise UnexpectedContentType(source=response)
|
|
181
184
|
|
|
182
185
|
# In addition to returning an HTTP response code, implementers MUST return
|
|
@@ -237,8 +240,8 @@ class SCIMClient:
|
|
|
237
240
|
resource: Union[AnyResource, Dict],
|
|
238
241
|
check_request_payload: bool = True,
|
|
239
242
|
check_response_payload: bool = True,
|
|
240
|
-
|
|
241
|
-
raise_scim_errors: bool =
|
|
243
|
+
expected_status_codes: Optional[List[int]] = CREATION_RESPONSE_STATUS_CODES,
|
|
244
|
+
raise_scim_errors: bool = True,
|
|
242
245
|
**kwargs,
|
|
243
246
|
) -> Union[AnyResource, Error, Dict]:
|
|
244
247
|
"""Perform a POST request to create, as defined in :rfc:`RFC7644 §3.3
|
|
@@ -250,7 +253,8 @@ class SCIMClient:
|
|
|
250
253
|
:code:`resource` is expected to be a dict that will be passed as-is in the request.
|
|
251
254
|
:param check_response_payload: Whether to validate that the response payload is valid.
|
|
252
255
|
If set, the raw payload will be returned.
|
|
253
|
-
:param
|
|
256
|
+
:param expected_status_codes: The list of expected status codes form the response.
|
|
257
|
+
If :data:`None` any status code is accepted.
|
|
254
258
|
:param raise_scim_errors: If :data:`True` and the server returned an
|
|
255
259
|
:class:`~scim2_models.Error` object, a :class:`~scim2_client.SCIMResponseErrorObject`
|
|
256
260
|
exception will be raised. If :data:`False` the error object is returned.
|
|
@@ -315,9 +319,7 @@ class SCIMClient:
|
|
|
315
319
|
|
|
316
320
|
return self.check_response(
|
|
317
321
|
response=response,
|
|
318
|
-
expected_status_codes=
|
|
319
|
-
self.CREATION_RESPONSE_STATUS_CODES if check_status_code else None
|
|
320
|
-
),
|
|
322
|
+
expected_status_codes=expected_status_codes,
|
|
321
323
|
expected_types=([resource.__class__] if check_request_payload else None),
|
|
322
324
|
check_response_payload=check_response_payload,
|
|
323
325
|
raise_scim_errors=raise_scim_errors,
|
|
@@ -331,8 +333,8 @@ class SCIMClient:
|
|
|
331
333
|
search_request: Optional[Union[SearchRequest, Dict]] = None,
|
|
332
334
|
check_request_payload: bool = True,
|
|
333
335
|
check_response_payload: bool = True,
|
|
334
|
-
|
|
335
|
-
raise_scim_errors: bool =
|
|
336
|
+
expected_status_codes: Optional[List[int]] = QUERY_RESPONSE_STATUS_CODES,
|
|
337
|
+
raise_scim_errors: bool = True,
|
|
336
338
|
**kwargs,
|
|
337
339
|
) -> Union[AnyResource, ListResponse[AnyResource], Error, Dict]:
|
|
338
340
|
"""Perform a GET request to read resources, as defined in :rfc:`RFC7644
|
|
@@ -348,7 +350,8 @@ class SCIMClient:
|
|
|
348
350
|
:code:`search_request` is expected to be a dict that will be passed as-is in the request.
|
|
349
351
|
:param check_response_payload: Whether to validate that the response payload is valid.
|
|
350
352
|
If set, the raw payload will be returned.
|
|
351
|
-
:param
|
|
353
|
+
:param expected_status_codes: The list of expected status codes form the response.
|
|
354
|
+
If :data:`None` any status code is accepted.
|
|
352
355
|
:param raise_scim_errors: If :data:`True` and the server returned an
|
|
353
356
|
:class:`~scim2_models.Error` object, a :class:`~scim2_client.SCIMResponseErrorObject`
|
|
354
357
|
exception will be raised. If :data:`False` the error object is returned.
|
|
@@ -444,9 +447,7 @@ class SCIMClient:
|
|
|
444
447
|
|
|
445
448
|
return self.check_response(
|
|
446
449
|
response=response,
|
|
447
|
-
expected_status_codes=
|
|
448
|
-
self.QUERY_RESPONSE_STATUS_CODES if check_status_code else None
|
|
449
|
-
),
|
|
450
|
+
expected_status_codes=expected_status_codes,
|
|
450
451
|
expected_types=expected_types,
|
|
451
452
|
check_response_payload=check_response_payload,
|
|
452
453
|
raise_scim_errors=raise_scim_errors,
|
|
@@ -458,8 +459,8 @@ class SCIMClient:
|
|
|
458
459
|
search_request: Optional[SearchRequest] = None,
|
|
459
460
|
check_request_payload: bool = True,
|
|
460
461
|
check_response_payload: bool = True,
|
|
461
|
-
|
|
462
|
-
raise_scim_errors: bool =
|
|
462
|
+
expected_status_codes: Optional[List[int]] = SEARCH_RESPONSE_STATUS_CODES,
|
|
463
|
+
raise_scim_errors: bool = True,
|
|
463
464
|
**kwargs,
|
|
464
465
|
) -> Union[AnyResource, ListResponse[AnyResource], Error, Dict]:
|
|
465
466
|
"""Perform a POST search request to read all available resources, as
|
|
@@ -472,7 +473,8 @@ class SCIMClient:
|
|
|
472
473
|
:code:`search_request` is expected to be a dict that will be passed as-is in the request.
|
|
473
474
|
:param check_response_payload: Whether to validate that the response payload is valid.
|
|
474
475
|
If set, the raw payload will be returned.
|
|
475
|
-
:param
|
|
476
|
+
:param expected_status_codes: The list of expected status codes form the response.
|
|
477
|
+
If :data:`None` any status code is accepted.
|
|
476
478
|
:param raise_scim_errors: If :data:`True` and the server returned an
|
|
477
479
|
:class:`~scim2_models.Error` object, a :class:`~scim2_client.SCIMResponseErrorObject`
|
|
478
480
|
exception will be raised. If :data:`False` the error object is returned.
|
|
@@ -525,9 +527,7 @@ class SCIMClient:
|
|
|
525
527
|
|
|
526
528
|
return self.check_response(
|
|
527
529
|
response=response,
|
|
528
|
-
expected_status_codes=
|
|
529
|
-
self.SEARCH_RESPONSE_STATUS_CODES if check_status_code else None
|
|
530
|
-
),
|
|
530
|
+
expected_status_codes=expected_status_codes,
|
|
531
531
|
expected_types=[ListResponse[Union[self.resource_types]]],
|
|
532
532
|
check_response_payload=check_response_payload,
|
|
533
533
|
raise_scim_errors=raise_scim_errors,
|
|
@@ -539,8 +539,8 @@ class SCIMClient:
|
|
|
539
539
|
resource_type: Type,
|
|
540
540
|
id: str,
|
|
541
541
|
check_response_payload: bool = True,
|
|
542
|
-
|
|
543
|
-
raise_scim_errors: bool =
|
|
542
|
+
expected_status_codes: Optional[List[int]] = DELETION_RESPONSE_STATUS_CODES,
|
|
543
|
+
raise_scim_errors: bool = True,
|
|
544
544
|
**kwargs,
|
|
545
545
|
) -> Optional[Union[Error, Dict]]:
|
|
546
546
|
"""Perform a DELETE request to create, as defined in :rfc:`RFC7644 §3.6
|
|
@@ -550,7 +550,8 @@ class SCIMClient:
|
|
|
550
550
|
:param id: The type id the resource to delete.
|
|
551
551
|
:param check_response_payload: Whether to validate that the response payload is valid.
|
|
552
552
|
If set, the raw payload will be returned.
|
|
553
|
-
:param
|
|
553
|
+
:param expected_status_codes: The list of expected status codes form the response.
|
|
554
|
+
If :data:`None` any status code is accepted.
|
|
554
555
|
:param raise_scim_errors: If :data:`True` and the server returned an
|
|
555
556
|
:class:`~scim2_models.Error` object, a :class:`~scim2_client.SCIMResponseErrorObject`
|
|
556
557
|
exception will be raised. If :data:`False` the error object is returned.
|
|
@@ -585,9 +586,7 @@ class SCIMClient:
|
|
|
585
586
|
|
|
586
587
|
return self.check_response(
|
|
587
588
|
response=response,
|
|
588
|
-
expected_status_codes=
|
|
589
|
-
self.DELETION_RESPONSE_STATUS_CODES if check_status_code else None
|
|
590
|
-
),
|
|
589
|
+
expected_status_codes=expected_status_codes,
|
|
591
590
|
check_response_payload=check_response_payload,
|
|
592
591
|
raise_scim_errors=raise_scim_errors,
|
|
593
592
|
)
|
|
@@ -597,8 +596,8 @@ class SCIMClient:
|
|
|
597
596
|
resource: Union[AnyResource, Dict],
|
|
598
597
|
check_request_payload: bool = True,
|
|
599
598
|
check_response_payload: bool = True,
|
|
600
|
-
|
|
601
|
-
raise_scim_errors: bool =
|
|
599
|
+
expected_status_codes: Optional[List[int]] = REPLACEMENT_RESPONSE_STATUS_CODES,
|
|
600
|
+
raise_scim_errors: bool = True,
|
|
602
601
|
**kwargs,
|
|
603
602
|
) -> Union[AnyResource, Error, Dict]:
|
|
604
603
|
"""Perform a PUT request to replace a resource, as defined in
|
|
@@ -610,7 +609,8 @@ class SCIMClient:
|
|
|
610
609
|
:code:`resource` is expected to be a dict that will be passed as-is in the request.
|
|
611
610
|
:param check_response_payload: Whether to validate that the response payload is valid.
|
|
612
611
|
If set, the raw payload will be returned.
|
|
613
|
-
:param
|
|
612
|
+
:param expected_status_codes: The list of expected status codes form the response.
|
|
613
|
+
If :data:`None` any status code is accepted.
|
|
614
614
|
:param raise_scim_errors: If :data:`True` and the server returned an
|
|
615
615
|
:class:`~scim2_models.Error` object, a :class:`~scim2_client.SCIMResponseErrorObject`
|
|
616
616
|
exception will be raised. If :data:`False` the error object is returned.
|
|
@@ -684,9 +684,7 @@ class SCIMClient:
|
|
|
684
684
|
|
|
685
685
|
return self.check_response(
|
|
686
686
|
response=response,
|
|
687
|
-
expected_status_codes=
|
|
688
|
-
self.REPLACEMENT_RESPONSE_STATUS_CODES if check_status_code else None
|
|
689
|
-
),
|
|
687
|
+
expected_status_codes=expected_status_codes,
|
|
690
688
|
expected_types=([resource.__class__] if check_request_payload else None),
|
|
691
689
|
check_response_payload=check_response_payload,
|
|
692
690
|
raise_scim_errors=raise_scim_errors,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|