Skip to content

Commit ae0d6ab

Browse files
committed
- Deleted old API files which doesn't exist in the new YAML specs.
- In the themes_api.py modified the code to accept the file parameter and send it further in the request. - In the http_client.py, handled the code to accept file data in the request and set it in the aiohttp request. - Updated ENUM of OtpTotpAlgorithm according to the API results. - Added missing import statement in the api_client.py and api_client.mustache. - Added integration tests for the device_posture_check_api.py file.
1 parent 4916076 commit ae0d6ab

File tree

11 files changed

+498
-3910
lines changed

11 files changed

+498
-3910
lines changed

okta/api/device_access_api.py

Lines changed: 0 additions & 1543 deletions
This file was deleted.

okta/api/risk_event_api.py

Lines changed: 0 additions & 412 deletions
This file was deleted.

okta/api/risk_provider_api.py

Lines changed: 0 additions & 1946 deletions
This file was deleted.

okta/api/themes_api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1520,7 +1520,7 @@ async def upload_brand_theme_logo(
15201520
:type _host_index: int, optional
15211521
:return: Returns the result object.
15221522
""" # noqa: E501
1523-
1523+
import pdb; pdb.set_trace()
15241524
_response_types_map: Dict[str, Optional[str]] = {
15251525
'200': "ImageUploadResponse",
15261526
'400': "Error",
@@ -1539,7 +1539,7 @@ async def upload_brand_theme_logo(
15391539
_host_index=_host_index
15401540
)
15411541

1542-
form = {}
1542+
form = {"file": file}
15431543
keep_empty_params = False
15441544

15451545
request, error = await self._request_executor.create_request(

okta/api_client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
from urllib.parse import quote
3333
from typing import Tuple, Optional, List, Dict, Union
3434
from pydantic import SecretStr
35+
from pydash.strings import camel_case
3536

3637
from okta.configuration import Configuration
3738
from okta.api_response import ApiResponse, T as ApiResponseT

okta/http_client.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,15 @@ async def send_request(self, request):
9494
if request['data']:
9595
params['data'] = json.dumps(request['data'])
9696
elif request['form']:
97-
params['data'] = request['form']
97+
filename = ""
98+
if isinstance(request['form']['file'], str):
99+
filename = request['form']['file'].split('/')[-1]
100+
data = aiohttp.FormData()
101+
data.add_field('file',
102+
open(request['form']['file'], 'rb'),
103+
filename=filename,
104+
content_type=self._default_headers['Content-Type'])
105+
params['data'] = data
98106
json_data = request.get('json')
99107
# empty json param may cause issue, so include it if needed only
100108
# more details: https://github.com/okta/okta-sdk-python/issues/131

okta/models/otp_totp_algorithm.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ class OtpTotpAlgorithm(str, Enum):
3333
"""
3434
allowed enum values
3535
"""
36-
HMACSHA1 = 'HMacSHA1'
37-
HMACSHA256 = 'HMacSHA256'
38-
HMACSHA512 = 'HMacSHA512'
36+
HMACSHA1 = 'HMACSHA1'
37+
HMACSHA256 = 'HMACSHA256'
38+
HMACSHA512 = 'HMACSHA512'
3939

4040
@classmethod
4141
def from_json(cls, json_str: str) -> Self:

openapi/api.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72927,9 +72927,9 @@ components:
7292772927
description: HMAC algorithm
7292872928
type: string
7292972929
enum:
72930-
- HMacSHA1
72931-
- HMacSHA256
72932-
- HMacSHA512
72930+
- HMACSHA1
72931+
- HMACSHA256
72932+
- HMACSHA512
7293372933
OtpTotpEncoding:
7293472934
description: The shared secret encoding
7293572935
type: string

openapi/templates/api_client.mustache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ from blinker import signal
2121
from urllib.parse import quote
2222
from typing import Tuple, Optional, List, Dict, Union
2323
from pydantic import SecretStr
24+
from pydash.strings import camel_case
2425
{{#tornado}}
2526
import tornado.gen
2627
{{/tornado}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,296 @@
1+
interactions:
2+
- request:
3+
body: '{"description": "Test custom posture check", "mappingType": "TEXTBOX",
4+
"name": "python_sdk_posture_check", "platform": "WINDOWS", "query": "SELECT
5+
* FROM programs WHERE name = ''AcmeCorpAgent'';", "type": "CUSTOM"}'
6+
headers:
7+
Accept:
8+
- application/json
9+
Authorization:
10+
- SSWS myAPIToken
11+
Content-Type:
12+
- application/json
13+
User-Agent:
14+
- OpenAPI-Generator/1.0.0/python
15+
method: POST
16+
uri: https://test.okta.com/api/v1/device-posture-checks
17+
response:
18+
body:
19+
string: '{"errorCode":"E0000015","errorSummary":"You do not have permission
20+
to access the feature you are requesting","errorLink":"E0000015","errorId":"oaeYg2muDmAQtCoakYD4NTSwg","errorCauses":[]}'
21+
headers:
22+
Cache-Control:
23+
- no-cache, no-store
24+
Connection:
25+
- keep-alive
26+
Content-Type:
27+
- application/json
28+
Date:
29+
- Wed, 14 Jan 2026 19:52:17 GMT
30+
Expires:
31+
- '0'
32+
Pragma:
33+
- no-cache
34+
Server:
35+
- nginx
36+
Set-Cookie:
37+
- sid="";Version=1;Path=/;Max-Age=0
38+
- xids="";Version=1;Path=/;Max-Age=0
39+
- autolaunch_triggered=""; Expires=Thu, 01 Jan 1970 00:00:10 GMT; Path=/
40+
- activate_ca_modal_triggered=""; Expires=Thu, 01 Jan 1970 00:00:10 GMT; Path=/
41+
- JSESSIONID=AD176CE4DA70A1D9F6D8444C079AF26C; Path=/; Secure; HttpOnly
42+
Strict-Transport-Security:
43+
- max-age=315360000; includeSubDomains
44+
Transfer-Encoding:
45+
- chunked
46+
accept-ch:
47+
- Sec-CH-UA-Platform-Version
48+
content-security-policy:
49+
- 'default-src ''self'' dev-20982288.okta.com *.oktacdn.com; connect-src ''self''
50+
dev-20982288.okta.com dev-20982288-admin.okta.com *.oktacdn.com *.mixpanel.com
51+
*.mapbox.com dev-20982288.kerberos.okta.com *.authenticatorlocalprod.com:8769
52+
http://localhost:8769 http://127.0.0.1:8769 *.authenticatorlocalprod.com:65111
53+
http://localhost:65111 http://127.0.0.1:65111 *.authenticatorlocalprod.com:65121
54+
http://localhost:65121 http://127.0.0.1:65121 *.authenticatorlocalprod.com:65131
55+
http://localhost:65131 http://127.0.0.1:65131 *.authenticatorlocalprod.com:65141
56+
http://localhost:65141 http://127.0.0.1:65141 *.authenticatorlocalprod.com:65151
57+
http://localhost:65151 http://127.0.0.1:65151 https://oinmanager.okta.com
58+
data: *.ingest.sentry.io; script-src ''unsafe-inline'' ''self'' ''report-sample''
59+
dev-20982288.okta.com *.oktacdn.com; style-src ''unsafe-inline'' ''self''
60+
''report-sample'' dev-20982288.okta.com *.oktacdn.com; frame-src ''self''
61+
dev-20982288.okta.com dev-20982288-admin.okta.com login.okta.com *.vidyard.com
62+
com-okta-authenticator:; img-src ''self'' dev-20982288.okta.com *.oktacdn.com
63+
*.tiles.mapbox.com *.mapbox.com *.vidyard.com data: blob:; font-src ''self''
64+
dev-20982288.okta.com data: *.oktacdn.com fonts.gstatic.com; frame-ancestors
65+
''self'''
66+
p3p:
67+
- CP="HONK"
68+
referrer-policy:
69+
- strict-origin-when-cross-origin
70+
x-content-type-options:
71+
- nosniff
72+
x-okta-request-id:
73+
- 2cd418ad726399448ecd95383f91b552
74+
x-rate-limit-limit:
75+
- '50'
76+
x-rate-limit-remaining:
77+
- '49'
78+
x-rate-limit-reset:
79+
- '1768420397'
80+
x-xss-protection:
81+
- '0'
82+
status:
83+
code: 401
84+
message: Unauthorized
85+
- request:
86+
body: null
87+
headers:
88+
Accept:
89+
- application/json
90+
Authorization:
91+
- SSWS myAPIToken
92+
User-Agent:
93+
- OpenAPI-Generator/1.0.0/python
94+
method: GET
95+
uri: https://test.okta.com/api/v1/device-posture-checks/default
96+
response:
97+
body:
98+
string: '{"errorCode":"E0000015","errorSummary":"You do not have permission
99+
to access the feature you are requesting","errorLink":"E0000015","errorId":"oaeq67K4xcuTbCD3ralUf_k8Q","errorCauses":[]}'
100+
headers:
101+
Connection:
102+
- keep-alive
103+
Content-Type:
104+
- application/json
105+
Date:
106+
- Wed, 14 Jan 2026 19:57:50 GMT
107+
Server:
108+
- nginx
109+
Set-Cookie:
110+
- sid="";Version=1;Path=/;Max-Age=0
111+
- xids="";Version=1;Path=/;Max-Age=0
112+
- autolaunch_triggered=""; Expires=Thu, 01 Jan 1970 00:00:10 GMT; Path=/
113+
- activate_ca_modal_triggered=""; Expires=Thu, 01 Jan 1970 00:00:10 GMT; Path=/
114+
Strict-Transport-Security:
115+
- max-age=315360000; includeSubDomains
116+
Transfer-Encoding:
117+
- chunked
118+
accept-ch:
119+
- Sec-CH-UA-Platform-Version
120+
content-security-policy:
121+
- 'default-src ''self'' dev-20982288.okta.com *.oktacdn.com; connect-src ''self''
122+
dev-20982288.okta.com dev-20982288-admin.okta.com *.oktacdn.com *.mixpanel.com
123+
*.mapbox.com dev-20982288.kerberos.okta.com *.authenticatorlocalprod.com:8769
124+
http://localhost:8769 http://127.0.0.1:8769 *.authenticatorlocalprod.com:65111
125+
http://localhost:65111 http://127.0.0.1:65111 *.authenticatorlocalprod.com:65121
126+
http://localhost:65121 http://127.0.0.1:65121 *.authenticatorlocalprod.com:65131
127+
http://localhost:65131 http://127.0.0.1:65131 *.authenticatorlocalprod.com:65141
128+
http://localhost:65141 http://127.0.0.1:65141 *.authenticatorlocalprod.com:65151
129+
http://localhost:65151 http://127.0.0.1:65151 https://oinmanager.okta.com
130+
data: *.ingest.sentry.io; script-src ''unsafe-inline'' ''self'' ''report-sample''
131+
dev-20982288.okta.com *.oktacdn.com; style-src ''unsafe-inline'' ''self''
132+
''report-sample'' dev-20982288.okta.com *.oktacdn.com; frame-src ''self''
133+
dev-20982288.okta.com dev-20982288-admin.okta.com login.okta.com *.vidyard.com
134+
com-okta-authenticator:; img-src ''self'' dev-20982288.okta.com *.oktacdn.com
135+
*.tiles.mapbox.com *.mapbox.com *.vidyard.com data: blob:; font-src ''self''
136+
dev-20982288.okta.com data: *.oktacdn.com fonts.gstatic.com; frame-ancestors
137+
''self'''
138+
p3p:
139+
- CP="HONK"
140+
x-content-type-options:
141+
- nosniff
142+
x-okta-request-id:
143+
- 39ec68cab86257f4422513e708d2cabd
144+
x-xss-protection:
145+
- '0'
146+
status:
147+
code: 401
148+
message: Unauthorized
149+
- request:
150+
body: null
151+
headers:
152+
Accept:
153+
- application/json
154+
Authorization:
155+
- SSWS myAPIToken
156+
User-Agent:
157+
- OpenAPI-Generator/1.0.0/python
158+
method: GET
159+
uri: https://test.okta.com/api/v1/device-posture-checks
160+
response:
161+
body:
162+
string: '{"errorCode":"E0000015","errorSummary":"You do not have permission
163+
to access the feature you are requesting","errorLink":"E0000015","errorId":"oaei66HBll7SNuy8a7uX-FDZw","errorCauses":[]}'
164+
headers:
165+
Connection:
166+
- keep-alive
167+
Content-Type:
168+
- application/json
169+
Date:
170+
- Wed, 14 Jan 2026 19:57:51 GMT
171+
Server:
172+
- nginx
173+
Set-Cookie:
174+
- sid="";Version=1;Path=/;Max-Age=0
175+
- xids="";Version=1;Path=/;Max-Age=0
176+
- autolaunch_triggered=""; Expires=Thu, 01 Jan 1970 00:00:10 GMT; Path=/
177+
- activate_ca_modal_triggered=""; Expires=Thu, 01 Jan 1970 00:00:10 GMT; Path=/
178+
Strict-Transport-Security:
179+
- max-age=315360000; includeSubDomains
180+
Transfer-Encoding:
181+
- chunked
182+
accept-ch:
183+
- Sec-CH-UA-Platform-Version
184+
content-security-policy:
185+
- 'default-src ''self'' dev-20982288.okta.com *.oktacdn.com; connect-src ''self''
186+
dev-20982288.okta.com dev-20982288-admin.okta.com *.oktacdn.com *.mixpanel.com
187+
*.mapbox.com dev-20982288.kerberos.okta.com *.authenticatorlocalprod.com:8769
188+
http://localhost:8769 http://127.0.0.1:8769 *.authenticatorlocalprod.com:65111
189+
http://localhost:65111 http://127.0.0.1:65111 *.authenticatorlocalprod.com:65121
190+
http://localhost:65121 http://127.0.0.1:65121 *.authenticatorlocalprod.com:65131
191+
http://localhost:65131 http://127.0.0.1:65131 *.authenticatorlocalprod.com:65141
192+
http://localhost:65141 http://127.0.0.1:65141 *.authenticatorlocalprod.com:65151
193+
http://localhost:65151 http://127.0.0.1:65151 https://oinmanager.okta.com
194+
data: *.ingest.sentry.io; script-src ''unsafe-inline'' ''self'' ''report-sample''
195+
dev-20982288.okta.com *.oktacdn.com; style-src ''unsafe-inline'' ''self''
196+
''report-sample'' dev-20982288.okta.com *.oktacdn.com; frame-src ''self''
197+
dev-20982288.okta.com dev-20982288-admin.okta.com login.okta.com *.vidyard.com
198+
com-okta-authenticator:; img-src ''self'' dev-20982288.okta.com *.oktacdn.com
199+
*.tiles.mapbox.com *.mapbox.com *.vidyard.com data: blob:; font-src ''self''
200+
dev-20982288.okta.com data: *.oktacdn.com fonts.gstatic.com; frame-ancestors
201+
''self'''
202+
p3p:
203+
- CP="HONK"
204+
x-content-type-options:
205+
- nosniff
206+
x-okta-request-id:
207+
- 6d2b86a7787f8c363621f78401c196bf
208+
x-xss-protection:
209+
- '0'
210+
status:
211+
code: 401
212+
message: Unauthorized
213+
- request:
214+
body: '{"description": "Test custom posture check", "mappingType": "TEXTBOX",
215+
"name": "python_sdk_posture_check", "platform": "WINDOWS", "query": "SELECT
216+
* FROM programs WHERE name = ''AcmeCorpAgent'';", "type": "CUSTOM"}'
217+
headers:
218+
Accept:
219+
- application/json
220+
Authorization:
221+
- SSWS myAPIToken
222+
Content-Type:
223+
- application/json
224+
User-Agent:
225+
- OpenAPI-Generator/1.0.0/python
226+
method: POST
227+
uri: https://test.okta.com/api/v1/device-posture-checks
228+
response:
229+
body:
230+
string: '{"errorCode":"E0000015","errorSummary":"You do not have permission
231+
to access the feature you are requesting","errorLink":"E0000015","errorId":"oaeuCfpTKhUSPyVEl8Y-3hjow","errorCauses":[]}'
232+
headers:
233+
Cache-Control:
234+
- no-cache, no-store
235+
Connection:
236+
- keep-alive
237+
Content-Type:
238+
- application/json
239+
Date:
240+
- Wed, 14 Jan 2026 19:57:52 GMT
241+
Expires:
242+
- '0'
243+
Pragma:
244+
- no-cache
245+
Server:
246+
- nginx
247+
Set-Cookie:
248+
- sid="";Version=1;Path=/;Max-Age=0
249+
- xids="";Version=1;Path=/;Max-Age=0
250+
- autolaunch_triggered=""; Expires=Thu, 01 Jan 1970 00:00:10 GMT; Path=/
251+
- activate_ca_modal_triggered=""; Expires=Thu, 01 Jan 1970 00:00:10 GMT; Path=/
252+
- JSESSIONID=FF81A1FCA5CB9EAB6F249111AAE834E8; Path=/; Secure; HttpOnly
253+
Strict-Transport-Security:
254+
- max-age=315360000; includeSubDomains
255+
Transfer-Encoding:
256+
- chunked
257+
accept-ch:
258+
- Sec-CH-UA-Platform-Version
259+
content-security-policy:
260+
- 'default-src ''self'' dev-20982288.okta.com *.oktacdn.com; connect-src ''self''
261+
dev-20982288.okta.com dev-20982288-admin.okta.com *.oktacdn.com *.mixpanel.com
262+
*.mapbox.com dev-20982288.kerberos.okta.com *.authenticatorlocalprod.com:8769
263+
http://localhost:8769 http://127.0.0.1:8769 *.authenticatorlocalprod.com:65111
264+
http://localhost:65111 http://127.0.0.1:65111 *.authenticatorlocalprod.com:65121
265+
http://localhost:65121 http://127.0.0.1:65121 *.authenticatorlocalprod.com:65131
266+
http://localhost:65131 http://127.0.0.1:65131 *.authenticatorlocalprod.com:65141
267+
http://localhost:65141 http://127.0.0.1:65141 *.authenticatorlocalprod.com:65151
268+
http://localhost:65151 http://127.0.0.1:65151 https://oinmanager.okta.com
269+
data: *.ingest.sentry.io; script-src ''unsafe-inline'' ''self'' ''report-sample''
270+
dev-20982288.okta.com *.oktacdn.com; style-src ''unsafe-inline'' ''self''
271+
''report-sample'' dev-20982288.okta.com *.oktacdn.com; frame-src ''self''
272+
dev-20982288.okta.com dev-20982288-admin.okta.com login.okta.com *.vidyard.com
273+
com-okta-authenticator:; img-src ''self'' dev-20982288.okta.com *.oktacdn.com
274+
*.tiles.mapbox.com *.mapbox.com *.vidyard.com data: blob:; font-src ''self''
275+
dev-20982288.okta.com data: *.oktacdn.com fonts.gstatic.com; frame-ancestors
276+
''self'''
277+
p3p:
278+
- CP="HONK"
279+
referrer-policy:
280+
- strict-origin-when-cross-origin
281+
x-content-type-options:
282+
- nosniff
283+
x-okta-request-id:
284+
- de1978b1f844252edcb617ec39be99d1
285+
x-rate-limit-limit:
286+
- '50'
287+
x-rate-limit-remaining:
288+
- '49'
289+
x-rate-limit-reset:
290+
- '1768420732'
291+
x-xss-protection:
292+
- '0'
293+
status:
294+
code: 401
295+
message: Unauthorized
296+
version: 1

0 commit comments

Comments
 (0)