While exploring the NS1 client, I was unable to list the zones for a certain API key. This appears to be an issue with either Twisted, or the way that NS1 calls into Twisted.
The code to reproduce, below, was tested with Twisted 17.1.0 and Twisted 17.5.0.
$ python3.6 -m venv virtualenv
$ pip install pyopenssl service_identity 'twisted[tls]==17.1.0' nsone
$ . virtualenv/bin/activate && python
>>> from nsone import Config, NSONE
>>> c = Config('./conf/nsone.json')
>>> a = NSONE(config=c)
>>> a.zones().list()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/m/Documents/src/gitlab.com/tenome/mono-repo/interview/ctci-go/actual/ns1/virtualenv/lib/python3.6/site-packages/nsone/rest/zones.py", line 56, in list
errback=errback)
File "/Users/m/Documents/src/gitlab.com/tenome/mono-repo/interview/ctci-go/actual/ns1/virtualenv/lib/python3.6/site-packages/nsone/rest/resource.py", line 73, in _make_request
return self._transport.send(type, self._make_url(path), **kwargs)
File "/Users/m/Documents/src/gitlab.com/tenome/mono-repo/interview/ctci-go/actual/ns1/virtualenv/lib/python3.6/site-packages/nsone/rest/transport/twisted.py", line 169, in send
d = self.agent.request(method, str(url), theaders, bProducer)
File "/Users/m/Documents/src/gitlab.com/tenome/mono-repo/interview/ctci-go/actual/ns1/virtualenv/lib/python3.6/site-packages/twisted/web/client.py", line 1623, in request
parsedURI = URI.fromBytes(uri)
File "/Users/m/Documents/src/gitlab.com/tenome/mono-repo/interview/ctci-go/actual/ns1/virtualenv/lib/python3.6/site-packages/twisted/web/client.py", line 630, in fromBytes
scheme, netloc, path, params, query, fragment = http.urlparse(uri)
File "/Users/m/Documents/src/gitlab.com/tenome/mono-repo/interview/ctci-go/actual/ns1/virtualenv/lib/python3.6/site-packages/twisted/web/http.py", line 180, in urlparse
raise TypeError("url must be bytes, not unicode")
TypeError: url must be bytes, not unicode
Hi @destroyhimmyrobots I'm going to close out this issue since this project is deprecated. If this is still an issue for you feel free to open another issue on https://github.com/ns1/ns1-python
Hello,
While exploring the NS1 client, I was unable to list the zones for a certain API key. This appears to be an issue with either Twisted, or the way that NS1 calls into Twisted.
The code to reproduce, below, was tested with Twisted 17.1.0 and Twisted 17.5.0.
Here is the
nsone.json
configuration file: