Skip to content

Commit

Permalink
Merge pull request #15 from aaronweaver/revert-12-master
Browse files Browse the repository at this point in the history
Revert "Add support for custom DefectDojo URL prefix"
  • Loading branch information
aaronweaver authored Aug 14, 2018
2 parents de61c8f + 0eab5e5 commit 6313ba5
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions defectdojo_api/defectdojo.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ def __init__(self, host, api_key, user, api_version='v1', verify_ssl=True, timeo
self.verify_ssl = verify_ssl
self.proxies = proxies
self.timeout = timeout

if host.split('/') > 3:
self.custom_path = '/' + '/'.join(host.split('/')[3:]).rstrip('/')
else:
self.custom_path = ''

if not user_agent:
self.user_agent = 'DefectDojo_api/' + version
Expand All @@ -51,47 +46,46 @@ def __init__(self, host, api_key, user, api_version='v1', verify_ssl=True, timeo
requests.packages.urllib3.disable_warnings() # Disabling SSL warning messages if verification is disabled.

###### Helper Functions ######

def get_user_uri(self, user_id):
"""Returns the DefectDojo API URI for a user.
:param user_id: Id of the user
"""

return self.custom_path + "/api/" + self.api_version + "/users/" + str(user_id) + "/"
return "/api/" + self.api_version + "/users/" + str(user_id) + "/"

def get_engagement_uri(self, engagement_id):
"""Returns the DefectDojo API URI for an engagement.
:param engagement_id: Id of the engagement
"""
return self.custom_path + "/api/" + self.api_version + "/engagements/" + str(engagement_id) + "/"
return "/api/" + self.api_version + "/engagements/" + str(engagement_id) + "/"

def get_product_uri(self, product_id):
"""Returns the DefectDojo API URI for a product.
:param product_id: Id of the product
"""
return self.custom_path + "/api/" + self.api_version + "/products/" + str(product_id) + "/"
return "/api/" + self.api_version + "/products/" + str(product_id) + "/"

def get_test_uri(self, test_id):
"""Returns the DefectDojo API URI for a test.
:param test_id: Id of the test
"""
return self.custom_path + "/api/" + self.api_version + "/tests/" + str(test_id) + "/"
return "/api/" + self.api_version + "/tests/" + str(test_id) + "/"

def get_language_uri(self, language_type_id):
"""Returns the DefectDojo API URI for a langauge.
:param test_id: Id of the language
"""
return self.custom_path + "/api/" + self.api_version + "/language_types/" + str(language_type_id) + "/"
return "/api/" + self.api_version + "/language_types/" + str(language_type_id) + "/"

def get_tool_configuration_uri(self, tool_configuration_id):
"""Returns the DefectDojo API URI for a tool.
Expand Down

0 comments on commit 6313ba5

Please sign in to comment.