Traceback (most recent call last):
File "C:\Users\akshay\AppData\Local\Programs\Python\Python36-32\lib\site-packa
ges\urllib3\connection.py", line 141, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
File "C:\Users\akshay\AppData\Local\Programs\Python\Python36-32\lib\site-packa
ges\urllib3\util\connection.py", line 83, in create_connection
raise err
File "C:\Users\akshay\AppData\Local\Programs\Python\Python36-32\lib\site-packa
ges\urllib3\util\connection.py", line 73, in create_connection
sock.connect(sa)
ConnectionRefusedError: [WinError 10061] No connection could be made because the
target machine actively refused it
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\akshay\AppData\Local\Programs\Python\Python36-32\lib\site-packa
ges\urllib3\connectionpool.py", line 601, in urlopen
chunked=chunked)
File "C:\Users\akshay\AppData\Local\Programs\Python\Python36-32\lib\site-packa
ges\urllib3\connectionpool.py", line 357, in _make_request
conn.request(method, url, **httplib_request_kw)
File "C:\Users\akshay\AppData\Local\Programs\Python\Python36-32\lib\http\clien
t.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "C:\Users\akshay\AppData\Local\Programs\Python\Python36-32\lib\http\clien
t.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "C:\Users\akshay\AppData\Local\Programs\Python\Python36-32\lib\http\clien
t.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "C:\Users\akshay\AppData\Local\Programs\Python\Python36-32\lib\http\clien
t.py", line 1026, in _send_output
self.send(msg)
File "C:\Users\akshay\AppData\Local\Programs\Python\Python36-32\lib\http\clien
t.py", line 964, in send
self.connect()
File "C:\Users\akshay\AppData\Local\Programs\Python\Python36-32\lib\site-packa
ges\urllib3\connection.py", line 166, in connect
conn = self._new_conn()
File "C:\Users\akshay\AppData\Local\Programs\Python\Python36-32\lib\site-packa
ges\urllib3\connection.py", line 150, in _new_conn
self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object
at 0x03667FF0>: Failed to establish a new connection: [WinError 10061] No conne
ction could be made because the target machine actively refused it
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\akshay\AppData\Local\Programs\Python\Python36-32\lib\site-packa
ges\requests\adapters.py", line 440, in send
timeout=timeout
File "C:\Users\akshay\AppData\Local\Programs\Python\Python36-32\lib\site-packa
ges\urllib3\connectionpool.py", line 639, in urlopen
_stacktrace=sys.exc_info()[2])
File "C:\Users\akshay\AppData\Local\Programs\Python\Python36-32\lib\site-packa
ges\urllib3\util\retry.py", line 388, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=8090
ProxyError('Cannot connect to proxy.', NewConnectionError('<urllib3.connection.H
TTPConnection object at 0x03667FF0>: Failed to establish a new connection: [WinE
rror 10061] No connection could be made because the target machine actively refu
sed it',)))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "test.py", line 18, in <module>
zap.urlopen(target)
File "C:\Users\akshay\AppData\Local\Programs\Python\Python36-32\lib\site-packa
ges\zapv2\__init__.py", line 124, in urlopen
return requests.get(url, proxies=self.__proxies, verify=False, *args, **kwar
gs).text
File "C:\Users\akshay\AppData\Local\Programs\Python\Python36-32\lib\site-packa
ges\requests\api.py", line 72, in get
return request('get', url, params=params, **kwargs)
File "C:\Users\akshay\AppData\Local\Programs\Python\Python36-32\lib\site-packa
ges\requests\api.py", line 58, in request
return session.request(method=method, url=url, **kwargs)
File "C:\Users\akshay\AppData\Local\Programs\Python\Python36-32\lib\site-packa
ges\requests\sessions.py", line 508, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\akshay\AppData\Local\Programs\Python\Python36-32\lib\site-packa
ges\requests\sessions.py", line 618, in send
r = adapter.send(request, **kwargs)
File "C:\Users\akshay\AppData\Local\Programs\Python\Python36-32\lib\site-packa
ges\requests\adapters.py", line 502, in send
raise ProxyError(e, request=request)
requests.exceptions.ProxyError: HTTPConnectionPool(host='127.0.0.1', port=8090):
oxyError('Cannot connect to proxy.', NewConnectionError('<urllib3.connection.HTT
PConnection object at 0x03667FF0>: Failed to establish a new connection: [WinErr
or 10061] No connection could be made because the target machine actively refuse
d it',)))
Following is my code:
import time
from pprint import pprint
from zapv2 import ZAPv2
#apikey = 'changeme' # Change to match the API key set in ZAP, or use None if the API key is disabled
#
# By default ZAP API client will connect to port 8080
#zap = ZAPv2()
# Use the line below if ZAP is not listening on port 8080, for example, if listening on port 8090
# Proxy a request to the target so that ZAP has something to deal with
print('Accessing target {}'.format(target))
zap.urlopen(target)
# Give the sites tree a chance to get updated
time.sleep(2)