esd-services-api-client 1.1.4__py3-none-any.whl → 1.1.5__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.
- esd_services_api_client/_version.py +1 -1
- esd_services_api_client/boxer/README.md +51 -39
- esd_services_api_client/boxer/_connector.py +112 -93
- esd_services_api_client/boxer/_models.py +21 -77
- {esd_services_api_client-1.1.4.dist-info → esd_services_api_client-1.1.5.dist-info}/METADATA +1 -1
- {esd_services_api_client-1.1.4.dist-info → esd_services_api_client-1.1.5.dist-info}/RECORD +8 -9
- esd_services_api_client/boxer/_helpers.py +0 -46
- {esd_services_api_client-1.1.4.dist-info → esd_services_api_client-1.1.5.dist-info}/LICENSE +0 -0
- {esd_services_api_client-1.1.4.dist-info → esd_services_api_client-1.1.5.dist-info}/WHEEL +0 -0
@@ -1 +1 @@
|
|
1
|
-
__version__ = '1.1.
|
1
|
+
__version__ = '1.1.5'
|
@@ -11,62 +11,74 @@ export BOXER_CONSUMER_ID="my_app_consumer"
|
|
11
11
|
export BOXER_PRIVATE_KEY="MIIEpAIBAA..."
|
12
12
|
```
|
13
13
|
|
14
|
-
### Retrieving
|
14
|
+
### Retrieving Claims:
|
15
15
|
|
16
16
|
```python
|
17
|
-
from esd_services_api_client.boxer import
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
from esd_services_api_client.boxer import select_authentication, BoxerClaimConnector
|
18
|
+
auth = select_authentication("azuread", "test")
|
19
|
+
conn = BoxerClaimConnector(base_url="https://boxer-claim.test.sneaksanddata.com", auth=auth)
|
20
|
+
resp = conn.get_claims("email@ecco.com", "azuread")
|
21
|
+
for claim in resp:
|
21
22
|
print(claim.to_dict())
|
22
23
|
```
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
from esd_services_api_client.boxer import BoxerConnector
|
28
|
-
conn = BoxerConnector(base_url="https://boxer.test.sneaksanddata.com")
|
29
|
-
claims = conn.get_claims_by_type("App1.AccessPolicy")
|
24
|
+
Output:
|
25
|
+
```bash
|
26
|
+
{'claim_name':'test1.test.sneaksanddata.com/.*', 'claim_value':'.*'}
|
27
|
+
{'claim_name':'test2.test.sneaksanddata.com/.*', 'claim_value':'.*'}
|
30
28
|
```
|
31
29
|
|
32
|
-
###
|
33
|
-
|
30
|
+
### Insert claims:
|
34
31
|
```python
|
35
|
-
from esd_services_api_client.boxer import
|
36
|
-
|
37
|
-
|
32
|
+
from esd_services_api_client.boxer import select_authentication, BoxerClaimConnector, Claim
|
33
|
+
auth = select_authentication("azuread", "test")
|
34
|
+
conn = BoxerClaimConnector(base_url="https://boxer-claim.test.sneaksanddata.com", auth=auth)
|
35
|
+
claims = [Claim("some-test-1.test.sneaksanddata.com", ".*"), Claim("some-test-2.test.sneaksanddata.com", ".*")]
|
36
|
+
resp = conn.add_claim("email@ecco.com", "azuread", claims)
|
37
|
+
print(resp)
|
38
38
|
```
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
from esd_services_api_client.boxer import BoxerConnector
|
43
|
-
from esd_services_api_client.boxer import BoxerClaim
|
44
|
-
claim = BoxerClaim(issuer="App1", claim_type="App1.CanManageConsumers", claim_value="true")
|
45
|
-
conn = BoxerConnector(base_url="https://boxer.test.sneaksanddata.com")
|
46
|
-
conn.push_user_claim(claim, "app1admin")
|
39
|
+
Output:
|
40
|
+
```bash
|
41
|
+
ClaimResponse(identity_provider='azuread', user_id='email@ecco.com', claims=[{'some-test-1.test.sneaksanddata.com': '.*'}, {'some-test-2.test.sneaksanddata.com': '.*'}], billing_id= None}
|
47
42
|
```
|
48
43
|
|
49
|
-
###
|
44
|
+
### Remove claims:
|
50
45
|
```python
|
51
|
-
from esd_services_api_client.boxer import
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
conn.
|
46
|
+
from esd_services_api_client.boxer import select_authentication, BoxerClaimConnector, Claim
|
47
|
+
auth = select_authentication("azuread", "test")
|
48
|
+
conn = BoxerClaimConnector(base_url="https://boxer-claim.test.sneaksanddata.com", auth=auth)
|
49
|
+
claims = [Claim("some-test-1.test.sneaksanddata.com", ".*"), Claim("some-test-2.test.sneaksanddata.com", ".*")]
|
50
|
+
resp = conn.remove_claim("email@ecco.com", "azuread", claims)
|
51
|
+
print(resp)
|
52
|
+
```
|
53
|
+
Output:
|
54
|
+
```bash
|
55
|
+
ClaimResponse(identity_provider='azuread', user_id='email@ecco.com', claims=[], billing_id= None}
|
56
56
|
```
|
57
57
|
|
58
|
-
###
|
58
|
+
### Add a user:
|
59
59
|
```python
|
60
|
-
from esd_services_api_client.boxer import
|
61
|
-
|
62
|
-
|
60
|
+
from esd_services_api_client.boxer import select_authentication, BoxerClaimConnector, Claim
|
61
|
+
auth = select_authentication("azuread", "test")
|
62
|
+
conn = BoxerClaimConnector(base_url="https://boxer-claim.test.sneaksanddata.com", auth=auth)
|
63
|
+
resp = conn.add_user("test@ecco.com", "azuread")
|
64
|
+
print(resp)
|
65
|
+
```
|
66
|
+
Output:
|
67
|
+
```bash
|
68
|
+
ClaimResponse(identity_provider='azuread', user_id='test@ecco.com', claims=[], billing_id=None)
|
63
69
|
```
|
64
70
|
|
65
|
-
###
|
71
|
+
### Remove a user:
|
66
72
|
```python
|
67
|
-
from esd_services_api_client.boxer import
|
68
|
-
|
69
|
-
|
73
|
+
from esd_services_api_client.boxer import select_authentication, BoxerClaimConnector, Claim
|
74
|
+
auth = select_authentication("azuread", "test")
|
75
|
+
conn = BoxerClaimConnector(base_url="https://boxer-claim.test.sneaksanddata.com", auth=auth)
|
76
|
+
resp = conn.remove_user("test@ecco.com", "azuread")
|
77
|
+
print(resp.status_code)
|
78
|
+
```
|
79
|
+
Output:
|
80
|
+
```bash
|
81
|
+
200
|
70
82
|
```
|
71
83
|
|
72
84
|
### Using as an authentication provider for other connectors
|
@@ -17,12 +17,12 @@
|
|
17
17
|
#
|
18
18
|
|
19
19
|
import os
|
20
|
-
from
|
20
|
+
from functools import reduce
|
21
|
+
from typing import Optional, Iterator, final
|
21
22
|
|
22
|
-
import jwt
|
23
23
|
from adapta.security.clients import AzureClient
|
24
24
|
from adapta.utils import session_with_retries
|
25
|
-
from requests import Session
|
25
|
+
from requests import Session, Response
|
26
26
|
|
27
27
|
from esd_services_api_client.boxer._base import BoxerTokenProvider
|
28
28
|
from esd_services_api_client.boxer._auth import (
|
@@ -32,11 +32,116 @@ from esd_services_api_client.boxer._auth import (
|
|
32
32
|
ExternalAuthBase,
|
33
33
|
RefreshableExternalTokenAuth,
|
34
34
|
)
|
35
|
-
from esd_services_api_client.boxer.
|
36
|
-
|
37
|
-
|
35
|
+
from esd_services_api_client.boxer._models import (
|
36
|
+
BoxerToken,
|
37
|
+
Claim,
|
38
|
+
ClaimPayload,
|
39
|
+
ClaimResponse,
|
38
40
|
)
|
39
|
-
|
41
|
+
|
42
|
+
|
43
|
+
@final
|
44
|
+
class BoxerClaimConnector:
|
45
|
+
"""
|
46
|
+
Boxer Claims API connector
|
47
|
+
"""
|
48
|
+
|
49
|
+
def __init__(self, *, base_url: str, auth: Optional[BoxerTokenAuth] = None):
|
50
|
+
"""Creates Boxer Claims connector, capable of managing claims
|
51
|
+
:param base_url: Base URL for Boxer Claims endpoint
|
52
|
+
:param auth: Boxer-based authentication
|
53
|
+
"""
|
54
|
+
self._base_url = base_url
|
55
|
+
self._http = session_with_retries()
|
56
|
+
if auth and isinstance(auth, BoxerTokenAuth):
|
57
|
+
self._http.hooks["response"].append(auth.get_refresh_hook(self._http))
|
58
|
+
self._http.auth = auth
|
59
|
+
|
60
|
+
def get_claims(self, user_id: str, provider: str) -> Optional[Iterator[Claim]]:
|
61
|
+
"""
|
62
|
+
Returns the claims assigned to the specified user_id and provider
|
63
|
+
"""
|
64
|
+
response = self._http.get(f"{self._base_url}/claim/{provider}/{user_id}")
|
65
|
+
if response.status_code == 404:
|
66
|
+
return None
|
67
|
+
response.raise_for_status()
|
68
|
+
return self._iterate_user_claims_response(response)
|
69
|
+
|
70
|
+
def add_user(self, user_id: str, provider: str) -> ClaimResponse:
|
71
|
+
"""
|
72
|
+
Adds a new user_id, provider pair
|
73
|
+
"""
|
74
|
+
response = self._http.post(f"{self._base_url}/claim/{provider}/{user_id}")
|
75
|
+
response.raise_for_status()
|
76
|
+
return ClaimResponse.from_dict(response.json())
|
77
|
+
|
78
|
+
def remove_user(self, user_id: str, provider: str) -> Response:
|
79
|
+
"""
|
80
|
+
Removes the specified user_id, provider pair and assigned claims
|
81
|
+
"""
|
82
|
+
response = self._http.delete(f"{self._base_url}/claim/{provider}/{user_id}")
|
83
|
+
response.raise_for_status()
|
84
|
+
return response
|
85
|
+
|
86
|
+
def add_claim(
|
87
|
+
self, user_id: str, provider: str, claims: list[Claim]
|
88
|
+
) -> Optional[ClaimResponse]:
|
89
|
+
"""
|
90
|
+
Adds a new claim to an existing user_id, provider pair
|
91
|
+
"""
|
92
|
+
payload_json = self._prepare_claim_payload(user_id, provider, claims, "Insert")
|
93
|
+
response = self._http.patch(
|
94
|
+
f"{self._base_url}/claim/{provider}/{user_id}",
|
95
|
+
data=payload_json,
|
96
|
+
headers={"Content-Type": "application/json"},
|
97
|
+
)
|
98
|
+
response.raise_for_status()
|
99
|
+
return ClaimResponse.from_dict(response.json())
|
100
|
+
|
101
|
+
def remove_claim(
|
102
|
+
self, user_id: str, provider: str, claims: list[Claim]
|
103
|
+
) -> Optional[ClaimResponse]:
|
104
|
+
"""
|
105
|
+
Removes the specified claim
|
106
|
+
"""
|
107
|
+
payload_json = self._prepare_claim_payload(user_id, provider, claims, "Delete")
|
108
|
+
response = self._http.patch(
|
109
|
+
f"{self._base_url}/claim/{provider}/{user_id}",
|
110
|
+
data=payload_json,
|
111
|
+
headers={"Content-Type": "application/json"},
|
112
|
+
)
|
113
|
+
return ClaimResponse.from_dict(response.json())
|
114
|
+
|
115
|
+
def _prepare_claim_payload(
|
116
|
+
self, user_id: str, provider: str, claims: list[Claim], operation: str
|
117
|
+
) -> Optional[str]:
|
118
|
+
"""
|
119
|
+
Prepare payload for Inserting/Deleting claims
|
120
|
+
"""
|
121
|
+
if self.get_claims(user_id, provider) is not None:
|
122
|
+
payload = ClaimPayload(operation, {})
|
123
|
+
claim_payload = reduce(
|
124
|
+
lambda cp, claim: cp.add_claim(claim), claims, payload
|
125
|
+
)
|
126
|
+
|
127
|
+
return claim_payload.to_json()
|
128
|
+
return None
|
129
|
+
|
130
|
+
def _iterate_user_claims_response(
|
131
|
+
self, user_claim_response: Response
|
132
|
+
) -> Optional[Iterator[Claim]]:
|
133
|
+
"""Creates an iterator to iterate user claims from Json Response
|
134
|
+
:param user_claim_response: HTTP Response
|
135
|
+
"""
|
136
|
+
response_json = user_claim_response.json()
|
137
|
+
if response_json and "claims" in response_json:
|
138
|
+
for claim in response_json["claims"]:
|
139
|
+
if isinstance(claim, dict) and len(claim) == 1:
|
140
|
+
for key, value in claim.items():
|
141
|
+
yield Claim.from_dict({"claim_name": key, "claim_value": value})
|
142
|
+
break
|
143
|
+
else:
|
144
|
+
raise ValueError("Expected response body of type application/json")
|
40
145
|
|
41
146
|
|
42
147
|
class BoxerConnector(BoxerTokenProvider):
|
@@ -65,92 +170,6 @@ class BoxerConnector(BoxerTokenProvider):
|
|
65
170
|
self.http.hooks["response"].append(auth.get_refresh_hook(self.http))
|
66
171
|
self.retry_attempts = retry_attempts
|
67
172
|
|
68
|
-
def push_user_claim(self, claim: BoxerClaim, user_id: str):
|
69
|
-
"""Adds/Overwrites a new Boxer Claim to a user
|
70
|
-
:param claim: Boxer Claim
|
71
|
-
:param user_id: User's UPN
|
72
|
-
:return:
|
73
|
-
"""
|
74
|
-
target_url = f"{self.base_url}/claims/user/{user_id}"
|
75
|
-
claim_json = claim.to_dict()
|
76
|
-
response = self.http.post(target_url, json=claim_json)
|
77
|
-
response.raise_for_status()
|
78
|
-
print(f"Successfully pushed user claim for user {user_id}")
|
79
|
-
|
80
|
-
def push_group_claim(self, claim: BoxerClaim, group_name: str):
|
81
|
-
"""Adds/Overwrites a new Boxer Claim to a user
|
82
|
-
:param claim: Boxer Claim
|
83
|
-
:param group_name: Group Name
|
84
|
-
:return:
|
85
|
-
"""
|
86
|
-
target_url = f"{self.base_url}/claims/group/{group_name}"
|
87
|
-
claim_json = claim.to_dict()
|
88
|
-
response = self.http.post(target_url, json=claim_json)
|
89
|
-
response.raise_for_status()
|
90
|
-
print(f"Successfully pushed user claim for group {group_name}")
|
91
|
-
|
92
|
-
def get_claims_by_type(self, claims_type: str) -> Iterator[UserClaim]:
|
93
|
-
"""Reads claims of specified type from Boxer.
|
94
|
-
:param claims_type: claim type to filter claims by.
|
95
|
-
:return: Iterator[UserClaim]
|
96
|
-
"""
|
97
|
-
target_url = f"{self.base_url}/claims/type/{claims_type}"
|
98
|
-
response = self.http.get(target_url)
|
99
|
-
response.raise_for_status()
|
100
|
-
return _iterate_user_claims_response(response)
|
101
|
-
|
102
|
-
def get_claims_by_user(self, user_id: str) -> Iterator[BoxerClaim]:
|
103
|
-
"""Reads user claims from Boxer
|
104
|
-
:param user_id: user upn to load claims for
|
105
|
-
:return: Iterator[UserClaim]
|
106
|
-
"""
|
107
|
-
empty_user_token = jwt.encode({"upn": user_id}, "_", algorithm="HS256")
|
108
|
-
target_url = f"{self.base_url}/claims/user/{empty_user_token}"
|
109
|
-
response = self.http.get(target_url)
|
110
|
-
response.raise_for_status()
|
111
|
-
return _iterate_boxer_claims_response(response)
|
112
|
-
|
113
|
-
def get_claims_by_group(self, group_name: str) -> Iterator[BoxerClaim]:
|
114
|
-
"""Reads group claims from Boxer
|
115
|
-
:param group_name: group name to load claims for
|
116
|
-
:return: Iterator[UserClaim]
|
117
|
-
"""
|
118
|
-
target_url = f"{self.base_url}/claims/group/{group_name}"
|
119
|
-
response = self.http.get(target_url)
|
120
|
-
response.raise_for_status()
|
121
|
-
return _iterate_boxer_claims_response(response)
|
122
|
-
|
123
|
-
def get_claims_for_token(self, jwt_token: str) -> Iterator[BoxerClaim]:
|
124
|
-
"""Reads user claims from Boxer based on jwt token
|
125
|
-
:param jwt_token: jwt token with UPN set
|
126
|
-
:return: Iterator[UserClaim]
|
127
|
-
"""
|
128
|
-
target_url = f"{self.base_url}/claims/user/{jwt_token}"
|
129
|
-
response = self.http.get(target_url)
|
130
|
-
response.raise_for_status()
|
131
|
-
return _iterate_boxer_claims_response(response)
|
132
|
-
|
133
|
-
def create_consumer(self, consumer_id: str, overwrite: bool = False) -> str:
|
134
|
-
"""Adds/Overwrites a new Boxer Claim to a user
|
135
|
-
:param consumer_id: Consumer ID of new consumer
|
136
|
-
:param overwrite: Flag to overwrite if consumer with given consumer_id already exists
|
137
|
-
:return: New consumer's private key (Base64 Encoded)
|
138
|
-
"""
|
139
|
-
target_url = f"{self.base_url}/consumer/{consumer_id}?overwrite={overwrite}"
|
140
|
-
response = self.http.post(target_url, json={})
|
141
|
-
response.raise_for_status()
|
142
|
-
return response.text
|
143
|
-
|
144
|
-
def get_consumer_public_key(self, consumer_id: str) -> str:
|
145
|
-
"""Reads Consumer's public key
|
146
|
-
:param consumer_id: Boxer Claim
|
147
|
-
:return: public key (Base64 Encoded)
|
148
|
-
"""
|
149
|
-
target_url = f"{self.base_url}/consumer/publicKey/{consumer_id}"
|
150
|
-
response = self.http.get(target_url, json={})
|
151
|
-
response.raise_for_status()
|
152
|
-
return response.text
|
153
|
-
|
154
173
|
def get_token(self) -> BoxerToken:
|
155
174
|
"""
|
156
175
|
Authorize with external token and return BoxerToken
|
@@ -17,106 +17,50 @@
|
|
17
17
|
#
|
18
18
|
|
19
19
|
from dataclasses import dataclass
|
20
|
-
from typing import Dict
|
21
20
|
|
21
|
+
from dataclasses_json import LetterCase, dataclass_json, DataClassJsonMixin
|
22
22
|
|
23
|
+
|
24
|
+
@dataclass_json
|
23
25
|
@dataclass
|
24
|
-
class
|
26
|
+
class Claim(DataClassJsonMixin):
|
25
27
|
"""
|
26
28
|
Boxer Claim
|
27
29
|
"""
|
28
30
|
|
29
|
-
|
31
|
+
claim_name: str
|
30
32
|
claim_value: str
|
31
|
-
issuer: str
|
32
|
-
|
33
|
-
def to_dict(self) -> Dict:
|
34
|
-
"""Convert to Dictionary
|
35
|
-
:return: Dictionary
|
36
|
-
"""
|
37
|
-
return {
|
38
|
-
"claimType": self.claim_type,
|
39
|
-
"claimValue": self.claim_value,
|
40
|
-
"issuer": self.issuer,
|
41
|
-
}
|
42
|
-
|
43
|
-
@classmethod
|
44
|
-
def from_dict(cls, json_data: Dict):
|
45
|
-
"""Initialize from Dictionary
|
46
|
-
:param json_data: Dictionary
|
47
|
-
:return:
|
48
|
-
"""
|
49
|
-
return BoxerClaim(
|
50
|
-
claim_type=json_data["claimType"],
|
51
|
-
claim_value=json_data["claimValue"],
|
52
|
-
issuer=json_data["issuer"],
|
53
|
-
)
|
54
33
|
|
55
34
|
|
35
|
+
@dataclass_json
|
56
36
|
@dataclass
|
57
|
-
class
|
37
|
+
class ClaimPayload(DataClassJsonMixin):
|
58
38
|
"""
|
59
|
-
Boxer
|
39
|
+
Boxer Claim Payload for Deleting/Inserting claims
|
60
40
|
"""
|
61
41
|
|
62
|
-
|
63
|
-
|
64
|
-
claim: BoxerClaim
|
42
|
+
operation: str
|
43
|
+
claims: dict
|
65
44
|
|
66
|
-
def
|
67
|
-
"""Convert to Dictionary
|
68
|
-
:return: Dictionary
|
45
|
+
def add_claim(self, claim: Claim) -> "ClaimPayload":
|
69
46
|
"""
|
70
|
-
|
71
|
-
"userId": self.user_id,
|
72
|
-
"userClaimId": self.user_claim_id,
|
73
|
-
"claim": self.claim.to_dict(),
|
74
|
-
}
|
75
|
-
|
76
|
-
@classmethod
|
77
|
-
def from_dict(cls, json_data: Dict):
|
78
|
-
"""Initialize from Dictionary
|
79
|
-
:param json_data: Dictionary
|
80
|
-
:return:
|
47
|
+
Add a claim to the ClaimPayload
|
81
48
|
"""
|
82
|
-
|
83
|
-
|
84
|
-
user_claim_id=json_data["userClaimId"],
|
85
|
-
claim=BoxerClaim.from_dict(json_data["claim"]),
|
86
|
-
)
|
49
|
+
self.claims |= {claim.claim_name: claim.claim_value}
|
50
|
+
return self
|
87
51
|
|
88
52
|
|
53
|
+
@dataclass_json(letter_case=LetterCase.CAMEL)
|
89
54
|
@dataclass
|
90
|
-
class
|
55
|
+
class ClaimResponse(DataClassJsonMixin):
|
91
56
|
"""
|
92
|
-
Boxer
|
57
|
+
Boxer Claim request response
|
93
58
|
"""
|
94
59
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
def to_dict(self) -> Dict:
|
100
|
-
"""Convert to Dictionary
|
101
|
-
:return: Dictionary
|
102
|
-
"""
|
103
|
-
return {
|
104
|
-
"groupName": self.group_name,
|
105
|
-
"groupClaimId": self.group_claim_id,
|
106
|
-
"claim": self.claim.to_dict(),
|
107
|
-
}
|
108
|
-
|
109
|
-
@classmethod
|
110
|
-
def from_dict(cls, json_data: Dict):
|
111
|
-
"""Initialize from Dictionary
|
112
|
-
:param json_data: Dictionary
|
113
|
-
:return:
|
114
|
-
"""
|
115
|
-
return GroupClaim(
|
116
|
-
group_name=json_data["groupName"],
|
117
|
-
group_claim_id=json_data["groupClaimId"],
|
118
|
-
claim=BoxerClaim.from_dict(json_data["claim"]),
|
119
|
-
)
|
60
|
+
identity_provider: str
|
61
|
+
user_id: str
|
62
|
+
claims: list[dict]
|
63
|
+
billing_id: str
|
120
64
|
|
121
65
|
|
122
66
|
class BoxerToken:
|
@@ -1,5 +1,5 @@
|
|
1
1
|
esd_services_api_client/__init__.py,sha256=rP0njtEgVSMm-sOVayVfcRUrrubl4lme7HI2zS678Lo,598
|
2
|
-
esd_services_api_client/_version.py,sha256=
|
2
|
+
esd_services_api_client/_version.py,sha256=hTCioFruYR1lv7FF57n5II-8lYry8FuIYb1fA4g2ccc,22
|
3
3
|
esd_services_api_client/beast/__init__.py,sha256=QwbmVfn2AOvfA-2_4I_hXpdiLr_kX319fPRpuOOgyqY,765
|
4
4
|
esd_services_api_client/beast/v2/__init__.py,sha256=9lVZVxos-Ljov5SvVzvrjTAxMCeJAfn1dIVSGM56QDU,749
|
5
5
|
esd_services_api_client/beast/v2/_connector.py,sha256=jjPjnHvNLrukcYnXjJKTnz4LMcbAlCzU76ysDbl_DcI,11302
|
@@ -7,19 +7,18 @@ esd_services_api_client/beast/v2/_models.py,sha256=XOTZqr83mX44SpXG4KBDEHJozVuDQ
|
|
7
7
|
esd_services_api_client/beast/v3/__init__.py,sha256=TRjB4-T6eIORpMvdylb32_GinrIpYNFmAdshSC1HqHg,749
|
8
8
|
esd_services_api_client/beast/v3/_connector.py,sha256=DrzlSAFw08NAtxf3u5VGVheamFE9gY2F50Z5Fg7QZe0,11585
|
9
9
|
esd_services_api_client/beast/v3/_models.py,sha256=q-tGQCJEaqQaHvE8HmooMem3fGkhWCyWrDXOPhdXCsU,6930
|
10
|
-
esd_services_api_client/boxer/README.md,sha256
|
10
|
+
esd_services_api_client/boxer/README.md,sha256=-MAhYUPvmEMcgx_lo_2PlH_gZI1lndGv8fnDQYIpurU,3618
|
11
11
|
esd_services_api_client/boxer/__init__.py,sha256=OYsWvdnLan0kmjUcH4I2-m1rbPeARKp5iqhp8uyudPk,780
|
12
12
|
esd_services_api_client/boxer/_auth.py,sha256=vA7T9y0oZV2f17UWQ2or9CK8vAsNnHB10G5HNQe1l1I,7440
|
13
13
|
esd_services_api_client/boxer/_base.py,sha256=PSU08QzTKFkXfzx7fF5FIHBOZXshxNEd1J_qKGo0Rd0,976
|
14
|
-
esd_services_api_client/boxer/_connector.py,sha256=
|
15
|
-
esd_services_api_client/boxer/
|
16
|
-
esd_services_api_client/boxer/_models.py,sha256=2tdVNRGQ0roR3THfzTq7KF2eQ5mS30PbxpqYhPm1y6A,3105
|
14
|
+
esd_services_api_client/boxer/_connector.py,sha256=kATr7IyQKtvsGlvgVInO_DsGGC4yCC1aW3RxoXt-QIM,8672
|
15
|
+
esd_services_api_client/boxer/_models.py,sha256=q_xRHOXlRroKrDrNUxQJUFGSotxYvUbRY1rYmx8UfJg,1697
|
17
16
|
esd_services_api_client/common/__init__.py,sha256=rP0njtEgVSMm-sOVayVfcRUrrubl4lme7HI2zS678Lo,598
|
18
17
|
esd_services_api_client/crystal/__init__.py,sha256=afSGQRkDic0ECsJfgu3b291kX8CyU57sjreqxj5cx-s,787
|
19
18
|
esd_services_api_client/crystal/_api_versions.py,sha256=2BMiQRS0D8IEpWCCys3dge5alVBRCZrOuCR1QAn8UIM,832
|
20
19
|
esd_services_api_client/crystal/_connector.py,sha256=yJObx9kHtaUmjry_B7EaJqbxn6t9aR0ypgrCGsCO5pI,12854
|
21
20
|
esd_services_api_client/crystal/_models.py,sha256=eRhGAl8LjglCyIFwf1bcFBhjbpSuRYucuF2LO388L2E,4025
|
22
|
-
esd_services_api_client-1.1.
|
23
|
-
esd_services_api_client-1.1.
|
24
|
-
esd_services_api_client-1.1.
|
25
|
-
esd_services_api_client-1.1.
|
21
|
+
esd_services_api_client-1.1.5.dist-info/LICENSE,sha256=0gS6zXsPp8qZhzi1xaGCIYPzb_0e8on7HCeFJe8fOpw,10693
|
22
|
+
esd_services_api_client-1.1.5.dist-info/METADATA,sha256=5qE27jp2LFYLK3LyO2TgiYmBjL5BadEumHwqM5W4sD8,1077
|
23
|
+
esd_services_api_client-1.1.5.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
24
|
+
esd_services_api_client-1.1.5.dist-info/RECORD,,
|
@@ -1,46 +0,0 @@
|
|
1
|
-
""" Helper functions to parse responses
|
2
|
-
"""
|
3
|
-
# Copyright (c) 2023. ECCO Sneaks & Data
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
#
|
17
|
-
|
18
|
-
from requests import Response
|
19
|
-
|
20
|
-
from esd_services_api_client.boxer._models import UserClaim, BoxerClaim
|
21
|
-
|
22
|
-
|
23
|
-
def _iterate_user_claims_response(user_claim_response: Response):
|
24
|
-
"""Creates an iterator to iterate user claims from Json Response
|
25
|
-
:param user_claim_response: HTTP Response containing json array of type UserClaim
|
26
|
-
"""
|
27
|
-
response_json = user_claim_response.json()
|
28
|
-
|
29
|
-
if response_json:
|
30
|
-
for api_response_item in response_json:
|
31
|
-
yield UserClaim.from_dict(api_response_item)
|
32
|
-
else:
|
33
|
-
raise ValueError("Expected response body of type application/json")
|
34
|
-
|
35
|
-
|
36
|
-
def _iterate_boxer_claims_response(boxer_claim_response: Response):
|
37
|
-
"""Creates an iterator to iterate user claims from Json Response
|
38
|
-
:param boxer_claim_response: HTTP Response containing json array of type BoxerClaim
|
39
|
-
"""
|
40
|
-
response_json = boxer_claim_response.json()
|
41
|
-
|
42
|
-
if response_json:
|
43
|
-
for api_response_item in response_json:
|
44
|
-
yield BoxerClaim.from_dict(api_response_item)
|
45
|
-
else:
|
46
|
-
raise ValueError("Expected response body of type application/json")
|
File without changes
|
File without changes
|