Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: quote_from_bytes() expected bytes in 0.0.20 #41

Closed
MyIgel opened this issue May 1, 2021 · 2 comments
Closed

TypeError: quote_from_bytes() expected bytes in 0.0.20 #41

MyIgel opened this issue May 1, 2021 · 2 comments

Comments

@MyIgel
Copy link

MyIgel commented May 1, 2021

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
@jagter
Copy link
Owner

jagter commented May 2, 2021

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"

@MyIgel
Copy link
Author

MyIgel commented May 2, 2021

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 :(

@MyIgel MyIgel closed this as completed May 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants