Some issues using OS proxy?
alfonsocaponi opened this issue · 2 comments
`Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/urllib3/connectionpool.py", line 667, in urlopen
self._prepare_proxy(conn)
File "/usr/local/lib/python3.6/dist-packages/urllib3/connectionpool.py", line 930, in _prepare_proxy
conn.connect()
File "/usr/local/lib/python3.6/dist-packages/urllib3/connection.py", line 316, in connect
self._tunnel()
File "/usr/lib/python3.6/http/client.py", line 935, in _tunnel
message.strip()))
OSError: Tunnel connection failed: 503 Forwarding failure
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/requests/adapters.py", line 449, in send
timeout=timeout
File "/usr/local/lib/python3.6/dist-packages/urllib3/connectionpool.py", line 725, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
File "/usr/local/lib/python3.6/dist-packages/urllib3/util/retry.py", line 439, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='***', port=443): Max retries exceeded with url: **** (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 503 Forwarding failure',)))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/bb/tools/JSA/jsa.py", line 144, in
main_func(original_lines, js_files_2nd_lvl, all_endpoints_1st_lvl)
File "/bb/tools/JSA/jsa.py", line 90, in main_func
js_file_status = requests.get(line, verify=False).status_code ## finding out a status code of js file url
File "/usr/local/lib/python3.6/dist-packages/requests/api.py", line 76, in get
return request('get', url, params=params, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/requests/api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/requests/sessions.py", line 530, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.6/dist-packages/requests/sessions.py", line 643, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/requests/adapters.py", line 510, in send
raise ProxyError(e, request=request)
requests.exceptions.ProxyError: HTTPSConnectionPool(host='*******', port=443): Max retries exceeded with url: **** (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 503 Forwarding failure',)))`
and exit from script execution :(
If a host responds for too long, the script can return an error - I'll try to suppress all the exceptions that the requests module returns so a script can move on to another js file.
Hi, I fixed it with
try:
js_file_status = requests.get(line, verify=False).status_code ## finding out a status code of js file url
except Exception:
pass
Closing now.