TypeError: quote_from_bytes() expected bytes in 0.0.20
Closed this issue · 2 comments
Looks like the 0.0.20 release introduced a bug somewhere, after the update from .19 i get the following error:
from netbox import NetBox
n = NetBox(host='netbox.domain.tld', auth_token='whatever')
x = n.ipam.get_ip_addresses(parent='1.2.3.0/24')
Traceback (most recent call last):
File "/builds/run.py", line 5, in export_reverse
address_list = netbox.ipam.get_ip_addresses(parent='1.2.3.0/24')
File "/usr/local/lib/python3.9/site-packages/netbox/ipam.py", line 36, in get_ip_addresses
return self.netbox_con.get('/ipam/ip-addresses/', **kwargs)
File "/usr/local/lib/python3.9/site-packages/netbox/connection.py", line 85, in get
'&'.join('{}={}'.format(key, urllib.parse.quote(val)) for key, val in kwargs.items()), limit)
File "/usr/local/lib/python3.9/site-packages/netbox/connection.py", line 85, in <genexpr>
'&'.join('{}={}'.format(key, urllib.parse.quote(val)) for key, val in kwargs.items()), limit)
File "/usr/local/lib/python3.9/urllib/parse.py", line 862, in quote
return quote_from_bytes(string, safe)
File "/usr/local/lib/python3.9/urllib/parse.py", line 887, in quote_from_bytes
raise TypeError("quote_from_bytes() expected bytes")
TypeError: quote_from_bytes() expected bytes
I've tried to reproduce the error without success. Which version of urllib3 have you installed?
Could you show me the call from the Netbox logging?
For example:
"GET /api/ipam/ip-addresses/?parent=10.0.0.1/24&limit=0 HTTP/1.1" 200 2411 "-" "python-requests/2.25.1"
urllib is used in version 1.26.4
and it never reaches the server, there are also no logs. I have a suspicion that it could be because the ip address was not converted to a str but as i currently have not enough time to look at it (and changed my code to use pynetbox as it seemed the fastest way), my dev env is currently messed up so i sadly can't have a second look at it. Sorry that i can not help here more :(