Skip to content

Commit

Permalink
remove requests lib from okta.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Fernando Aureliano da Silva Maia committed Oct 3, 2023
1 parent fd9e816 commit 2490a7f
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions tokendito/okta.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import bs4
from bs4 import BeautifulSoup
import requests
from tokendito import duo
from tokendito import user
from http_client import HTTPClient
Expand All @@ -43,11 +42,8 @@ def api_wrapper(url, payload, headers=None, http_client=None):
"""
logger.debug(f"Calling {url} with {headers}")
try:
# Use http_client for making the request if provided, else use requests directly
if http_client:
response = http_client.post(url, json=payload, headers=headers)
else:
response = requests.request("POST", url, data=json.dumps(payload), headers=headers)
http_client = HTTPClient()
response = http_client.post(url, json=payload, headers=headers)
response.raise_for_status()
except Exception as err:
logger.error(f"There was an error with the call to {url}: {err}")
Expand Down

0 comments on commit 2490a7f

Please sign in to comment.