From 9c7fc1dca3502b4c79fcff4c4713da58b3bf6d17 Mon Sep 17 00:00:00 2001 From: thc202 Date: Thu, 1 Jun 2017 22:58:11 +0100 Subject: [PATCH] Regenerate Openapi API Regenerate the API of the add-on "OpenAPI Support" (upcoming version 6). --- src/zapv2/openapi.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/zapv2/openapi.py b/src/zapv2/openapi.py index 05dc40a..c91d485 100644 --- a/src/zapv2/openapi.py +++ b/src/zapv2/openapi.py @@ -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)))