Skip to content

Commit 2dfb5b1

Browse files
committed
fixed system that passed headers by reference causing overwrite
1 parent c2a3546 commit 2dfb5b1

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

ThreadFixProApi/API.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ def request(self, method, url, params=None, files=None):
7373
if self.debug:
7474
print(method + ' ' + self.host + url)
7575
print(params)
76+
print(self.headers)
7677

7778
response = requests.request(method=method, url=self.host + url, params=params, files=files, headers=self.headers,
7879
timeout=self.timeout, verify=self.verify_ssl, cert=self.cert)
@@ -90,7 +91,7 @@ def request(self, method, url, params=None, files=None):
9091
try:
9192
response_code = json_response['responseCode']
9293
except KeyError:
93-
response_code= response.status_code
94+
response_code = response.status_code
9495
success = True if response_code >= 200 and response_code < 210 else False
9596
try:
9697
data = json_response['object']

ThreadFixProApi/ThreadFixProAPI.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@ def __init__(self, host, api_key, verify_ssl=True, timeout=30, headers=None, use
3030
"""
3131
super().__init__(host, api_key, verify_ssl, timeout, headers, user_agent, cert, debug)
3232
# Add on threadfix to application calls to make sure it can still work in a unified system as application endpoints are on /threadfix/{endpoint}
33-
self.Applications = ThreadFixProAPIApplications(self.host + '/threadfix', api_key, verify_ssl, timeout, self.headers, self.user_agent, cert, debug)
34-
self.Networks = ThreadFixProAPINetworks(self.host, api_key, verify_ssl, timeout, self.headers, self.user_agent, cert, debug)
33+
self.Applications = ThreadFixProAPIApplications(self.host + '/threadfix', api_key, verify_ssl, timeout, headers, user_agent, cert, debug)
34+
self.Networks = ThreadFixProAPINetworks(self.host, api_key, verify_ssl, timeout, headers, user_agent, cert, debug)

tests/tests.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ def network_test(threadfix, apikey):
2121
network_api = ThreadFixProAPINetworks(threadfix, apikey, verify_ssl=False)
2222
ret = network_api.VulnerabilitiesAPI.fetch_all_vulnerabilities()
2323
print(ret.data)
24+
ret2 = network_api.VulnerabilitiesAPI.fetch_all_vulnerabilities(href=ret.data['_links']['next']['href'])
25+
print(ret2.data)
2426

2527
network_test('https://demo.tfint.link', 'cKj2ZmbZkZoXMML5KwAlkwHN9CQDYU38ch9fBFUYPF0')
2628

0 commit comments

Comments
 (0)