Hey,
I am trying to set up Okta on Python 3.9 - GitHub - okta/okta-sdk-python
so, I did the following steps:
- pip3.9 install okta
-create token on the dev
Put the token & org on the matching fields on the following script:
“”""
import asyncio
from okta.client import Client as OktaClient
Instantiating with a Python dictionary in the constructor
config = {
‘orgUrl’: ‘https://{yourOktaDomain}’,
‘token’: ‘YOUR_API_TOKEN’
}
okta_client = OktaClient(config)
example of usage, list all users and print their first name and last name
async def main():
users, resp, err = await okta_client.list_users()
for user in users:
print(user.profile.first_name, user.profile.last_name)
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
“”"
Tried to run it and got the following exception:
Traceback (most recent call last):
File “/Users/avilevi/PycharmProjects/carbon-api/okta_play.py”, line 20, in
asyncio.run(main())
File “/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/runners.py”, line 44, in run
return loop.run_until_complete(main)
File “/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py”, line 642, in run_until_complete
return future.result()
File “/Users/avilevi/PycharmProjects/carbon-api/okta_play.py”, line 13, in main
users, resp, err = await client.list_users()
File “/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/okta/resource_clients/user_client.py”, line 101, in list_users
response, error = await self._request_executor
File “/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/okta/request_executor.py”, line 138, in execute
_, response, response_body, error = await self.fire_request(request)
File “/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/okta/request_executor.py”, line 175, in fire_request
_, res_details, resp_body, error = await
File “/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/okta/request_executor.py”, line 223, in fire_request_helper
check_429 = self.is_too_many_requests(res_details.status, resp_body)
AttributeError: ‘NoneType’ object has no attribute ‘status’
Tried other functions but get the same error, I also tried to create another token, same error.
Would be happy to get some help