Skip to content

Commit

Permalink
use caller session object for _perform_request
Browse files Browse the repository at this point in the history
  • Loading branch information
woodtechie1428 committed Sep 15, 2021
1 parent 1afd369 commit 3c95fe2
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions qualysclient/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,15 @@ def _api_request(caller, api_action, **kwargs):
input_params = kwargs
return _perform_request(caller, api_url, input_params, http_method)

def _perform_request(caller, api_url, input_params, http_method = 'GET'):
api_response = requests.request(
method=http_method,
url=api_url,
params=input_params,
headers=caller.s.headers,
cookies=caller.s.cookies)
def _perform_request(caller, api_url, input_params, http_method = 'POST'):
if (http_method == 'POST'):
api_response = caller.s.post(
url = api_url,
data = input_params
)
else:
api_response = caller.s.get(
url = api_url,
params = input_params
)
return api_response

0 comments on commit 3c95fe2

Please sign in to comment.