You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a dependency problem that should be documented at least.
Another solution is to hardcode in the requirements a version of urllib3 without the bug.
in the env environment, when writing the netbox URL, use "http://" instead of "https://"
install a bug free version of urllib3
when running the script i got the following
(venv) anubisg1@CZPRG-6VJY9Y3:~/Device-Type-Library-Import$ ./nb-dt-import.py
Package devicetype-library is already installed, updating /home/anubisg1/Device-Type-Library-Import/repo
Traceback (most recent call last):
File "/home/anubisg1/Device-Type-Library-Import/venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 467, in _make_request
self._validate_conn(conn)
File "/home/anubisg1/Device-Type-Library-Import/venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 1096, in _validate_conn
conn.connect()
File "/home/anubisg1/Device-Type-Library-Import/venv/lib/python3.10/site-packages/urllib3/connection.py", line 642, in connect
sock_and_verified = _ssl_wrap_socket_and_match_hostname(
File "/home/anubisg1/Device-Type-Library-Import/venv/lib/python3.10/site-packages/urllib3/connection.py", line 782, in _ssl_wrap_socket_and_match_hostname
ssl_sock = ssl_wrap_socket(
File "/home/anubisg1/Device-Type-Library-Import/venv/lib/python3.10/site-packages/urllib3/util/ssl_.py", line 470, in ssl_wrap_socket
ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls, server_hostname)
File "/home/anubisg1/Device-Type-Library-Import/venv/lib/python3.10/site-packages/urllib3/util/ssl_.py", line 514, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
File "/usr/lib/python3.10/ssl.py", line 513, in wrap_socket
return self.sslsocket_class._create(
File "/usr/lib/python3.10/ssl.py", line 1100, in _create
self.do_handshake()
File "/usr/lib/python3.10/ssl.py", line 1371, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1007)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/anubisg1/Device-Type-Library-Import/venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 790, in urlopen
response = self._make_request(
File "/home/anubisg1/Device-Type-Library-Import/venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 491, in _make_request
raise new_e
urllib3.exceptions.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1007)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/anubisg1/Device-Type-Library-Import/venv/lib/python3.10/site-packages/requests/adapters.py", line 486, in send
resp = conn.urlopen(
File "/home/anubisg1/Device-Type-Library-Import/venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 844, in urlopen
retries = retries.increment(
File "/home/anubisg1/Device-Type-Library-Import/venv/lib/python3.10/site-packages/urllib3/util/retry.py", line 515, in increment
raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type]
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='192.168.0.177', port=8000): Max retries exceeded with url: /api/ (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1007)')))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/anubisg1/Device-Type-Library-Import/./nb-dt-import.py", line 54, in <module>
main()
File "/home/anubisg1/Device-Type-Library-Import/./nb-dt-import.py", line 17, in main
netbox = NetBox(settings)
File "/home/anubisg1/Device-Type-Library-Import/netbox_api.py", line 28, in __init__
self.verify_compatibility()
File "/home/anubisg1/Device-Type-Library-Import/netbox_api.py", line 50, in verify_compatibility
version_split = [int(x) for x in self.netbox.version.split('.')]
File "/home/anubisg1/Device-Type-Library-Import/venv/lib/python3.10/site-packages/pynetbox/core/api.py", line 109, in version
).get_version()
File "/home/anubisg1/Device-Type-Library-Import/venv/lib/python3.10/site-packages/pynetbox/core/query.py", line 180, in get_version
req = self.http_session.get(
File "/home/anubisg1/Device-Type-Library-Import/venv/lib/python3.10/site-packages/requests/sessions.py", line 602, in get
return self.request("GET", url, **kwargs)
File "/home/anubisg1/Device-Type-Library-Import/venv/lib/python3.10/site-packages/requests/sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
File "/home/anubisg1/Device-Type-Library-Import/venv/lib/python3.10/site-packages/requests/sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
File "/home/anubisg1/Device-Type-Library-Import/venv/lib/python3.10/site-packages/requests/adapters.py", line 517, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='192.168.0.177', port=8000): Max retries exceeded with url: /api/ (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1007)')))
The text was updated successfully, but these errors were encountered:
This is a dependency problem that should be documented at least.
Another solution is to hardcode in the requirements a version of urllib3 without the bug.
the issue is the same as described here:
https://stackoverflow.com/questions/65516325/ssl-wrong-version-number-on-python-request
there are 2 solutions/workarounds
when running the script i got the following
The text was updated successfully, but these errors were encountered: