Pythonically build SCIM requests and parse SCIM responses
Project description
scim2-client
A SCIM client Python library built upon scim2-models and httpx, that pythonically build requests and parse responses, following the RFC7643 and RFC7644 specifications.
Installation
pip install scim2-client
Usage
Check the tutorial and the reference for more details.
Here is an example of usage:
import datetime
from httpx import Client
from scim2_models import User, EnterpriseUserUser, Group, Error
from scim2_client import SCIMClient
client = Client(base_url=f"https://auth.example/scim/v2", headers={"Authorization": "Bearer foobar"})
scim = SCIMClient(client, resource_types=(User[EnterpriseUser], Group))
# Query resources
user = scim.query(User, "2819c223-7f76-453a-919d-413861904646")
assert user.user_name == "bjensen@example.com"
assert user.meta.last_updated == datetime.datetime(
2024, 4, 13, 12, 0, 0, tzinfo=datetime.timezone.utc
)
# Update resources
user.display_name = "Babes Jensen"
user = scim.replace(user)
assert user.display_name == "Babes Jensen"
assert user.meta.last_updated == datetime.datetime(
2024, 4, 13, 12, 0, 30, tzinfo=datetime.timezone.utc
)
# Create resources
response = scim.create(User, "2819c223-7f76-453a-919d-413861904646")
assert isinstance(response, Error)
assert response.detail == "One or more of the attribute values are already in use or are reserved."
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
scim2_client-0.1.2.tar.gz
(5.3 kB
view hashes)
Built Distribution
Close
Hashes for scim2_client-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa0259176ca32d7fbf4049dea708eff5d7f012d9f4b3ded2f60bd931fe56c704 |
|
MD5 | f278c4d929b8065f751c46e6ed9e5735 |
|
BLAKE2b-256 | d5073623e7af66691aa365eeb99b8ce84d907e1d52fb05084e3b88163d9c1d30 |