scim2-client 0.4.0__py3-none-any.whl → 0.4.2__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
@@ -158,7 +158,7 @@ class SCIMClient:
158
158
  check_response_payload: bool = True,
159
159
  raise_scim_errors: bool = True,
160
160
  ):
161
- self.resource_models = tuple(set(resource_models or []) | set(CONFIG_RESOURCES))
161
+ self.resource_models = tuple(resource_models or [])
162
162
  self.resource_types = resource_types
163
163
  self.service_provider_config = service_provider_config
164
164
  self.check_request_payload = check_request_payload
@@ -798,14 +798,25 @@ class BaseSyncSCIMClient(SCIMClient):
798
798
  """
799
799
  raise NotImplementedError()
800
800
 
801
- def discover(self):
802
- """Dynamically discover the server models :class:`~scim2_models.Schema` and :class:`~scim2_models.ResourceType`."""
803
- resource_types_response = self.query(ResourceType)
804
- schemas_response = self.query(Schema)
805
- self.service_provider_config = self.query(ServiceProviderConfig)
806
- self.resource_types = resource_types_response.resources
807
- schemas = schemas_response.resources
808
- self.resource_models = self.build_resource_models(self.resource_types, schemas)
801
+ def discover(self, schemas=True, resource_types=True, service_provider_config=True):
802
+ """Dynamically discover the server configuration objects.
803
+
804
+ :param schemas: Whether to discover the :class:`~scim2_models.Schema` endpoint.
805
+ :param resource_types: Whether to discover the :class:`~scim2_models.ResourceType` endpoint.
806
+ :param service_provider_config: Whether to discover the :class:`~scim2_models.ServiceProviderConfig` endpoint.
807
+ """
808
+ if resource_types:
809
+ resource_types_response = self.query(ResourceType)
810
+ self.resource_types = resource_types_response.resources
811
+
812
+ if schemas:
813
+ schemas_response = self.query(Schema)
814
+ self.resource_models = self.build_resource_models(
815
+ self.resource_types, schemas_response.resources
816
+ )
817
+
818
+ if service_provider_config:
819
+ self.service_provider_config = self.query(ServiceProviderConfig)
809
820
 
810
821
 
811
822
  class BaseAsyncSCIMClient(SCIMClient):
@@ -1064,14 +1075,33 @@ class BaseAsyncSCIMClient(SCIMClient):
1064
1075
  """
1065
1076
  raise NotImplementedError()
1066
1077
 
1067
- async def discover(self):
1068
- """Dynamically discover the server models :class:`~scim2_models.Schema` and :class:`~scim2_models.ResourceType`."""
1069
- resources_task = asyncio.create_task(self.query(ResourceType))
1070
- schemas_task = asyncio.create_task(self.query(Schema))
1071
- spc_task = asyncio.create_task(self.query(ServiceProviderConfig))
1072
- resource_types_response = await resources_task
1073
- schemas_response = await schemas_task
1074
- self.service_provider_config = await spc_task
1075
- self.resource_types = resource_types_response.resources
1076
- schemas = schemas_response.resources
1077
- self.resource_models = self.build_resource_models(self.resource_types, schemas)
1078
+ async def discover(
1079
+ self, schemas=True, resource_types=True, service_provider_config=True
1080
+ ):
1081
+ """Dynamically discover the server configuration objects.
1082
+
1083
+ :param schemas: Whether to discover the :class:`~scim2_models.Schema` endpoint.
1084
+ :param resource_types: Whether to discover the :class:`~scim2_models.ResourceType` endpoint.
1085
+ :param service_provider_config: Whether to discover the :class:`~scim2_models.ServiceProviderConfig` endpoint.
1086
+ """
1087
+ if schemas:
1088
+ schemas_task = asyncio.create_task(self.query(Schema))
1089
+
1090
+ if resource_types:
1091
+ resources_types_task = asyncio.create_task(self.query(ResourceType))
1092
+
1093
+ if service_provider_config:
1094
+ spc_task = asyncio.create_task(self.query(ServiceProviderConfig))
1095
+
1096
+ if resource_types:
1097
+ resource_types_response = await resources_types_task
1098
+ self.resource_types = resource_types_response.resources
1099
+
1100
+ if schemas:
1101
+ schemas_response = await schemas_task
1102
+ self.resource_models = self.build_resource_models(
1103
+ self.resource_types, schemas_response.resources
1104
+ )
1105
+
1106
+ if service_provider_config:
1107
+ self.service_provider_config = await spc_task
@@ -72,12 +72,17 @@ class TestSCIMClient(BaseSyncSCIMClient):
72
72
  self.scim_prefix = scim_prefix
73
73
 
74
74
  def make_url(self, url: Optional[str]) -> str:
75
+ url = url or ""
75
76
  prefix = (
76
77
  self.scim_prefix[:-1]
77
78
  if self.scim_prefix.endswith("/")
78
79
  else self.scim_prefix
79
80
  )
80
- return f"{prefix}{url or ''}"
81
+ return (
82
+ url
83
+ if url.startswith("http://") or url.startswith("https://")
84
+ else f"{prefix}{url}"
85
+ )
81
86
 
82
87
  def create(
83
88
  self,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: scim2-client
3
- Version: 0.4.0
3
+ Version: 0.4.2
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
@@ -1,11 +1,11 @@
1
1
  scim2_client/__init__.py,sha256=l0pyBLiTpFA68ao98PqQLT_Xx0mw8BHumwrIHYCWa_M,845
2
- scim2_client/client.py,sha256=oS5ZVvQ-z9wfY-xjGTXxVjZZ9tAb8BvEAXH_eBdhBGE,44077
2
+ scim2_client/client.py,sha256=zxUU62PgTIiL-QlUnO4Pd6-kaAlGp3sfyNaytMmMSwI,45046
3
3
  scim2_client/errors.py,sha256=FVmRXsaZLn1VZhJ3dSDs4IqycuU92AEun9JWWMseVO8,4397
4
4
  scim2_client/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  scim2_client/engines/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  scim2_client/engines/httpx.py,sha256=L39ZZHjqe43uIQpgh_r_maqM2gkf3_Rk6d8MeNe57gk,17781
7
- scim2_client/engines/werkzeug.py,sha256=vWBITiF0FMEy1NXBBDCc5Y49CzQuztPURh2yurFyyMo,10096
8
- scim2_client-0.4.0.dist-info/METADATA,sha256=_fzzrIeYimg6g6sTq3ltewSWJFUHqootg-zsxJ5el-c,16961
9
- scim2_client-0.4.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
10
- scim2_client-0.4.0.dist-info/licenses/LICENSE.md,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
11
- scim2_client-0.4.0.dist-info/RECORD,,
7
+ scim2_client/engines/werkzeug.py,sha256=mVpK0GjmD4fu0jI0W2zqrn7GjBFZ0AjNk2gBO5415Gk,10230
8
+ scim2_client-0.4.2.dist-info/METADATA,sha256=KG9frELmv2zQN52PpoUtFjhJ5aHgBO49b556kUV78iU,16961
9
+ scim2_client-0.4.2.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
10
+ scim2_client-0.4.2.dist-info/licenses/LICENSE.md,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
11
+ scim2_client-0.4.2.dist-info/RECORD,,