Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/zapv2/openapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,17 @@ def __init__(self, zap):

def import_file(self, file, apikey=''):
"""
Import an Open API definition from a local file.
This component is optional and therefore the API will only work if it is installed
"""
return six.next(six.itervalues(self.zap._request(self.zap.base + 'openapi/action/importFile/', {'file': file, 'apikey': apikey})))

def import_url(self, url, apikey=''):
def import_url(self, url, hostoverride=None, apikey=''):
"""
Import an Open API definition from a URL, hostOverride allows the host to be replaced
This component is optional and therefore the API will only work if it is installed
"""
return six.next(six.itervalues(self.zap._request(self.zap.base + 'openapi/action/importUrl/', {'url': url, 'apikey': apikey})))
params = {'url': url, 'apikey': apikey}
if hostoverride is not None:
params['hostOverride'] = hostoverride
return six.next(six.itervalues(self.zap._request(self.zap.base + 'openapi/action/importUrl/', params)))