API_V1_ROOT is "api/v1" when it looks like it should be "/api/v1" or requests to the API fail because otx.alienvault.comapi is not a valid hostname for HTTP requests. I'm on Python 2.7.11 just fyi.
Simply prepending a backslash to the API_V1_ROOT variable fixed this for me when I reinstalled the latest master branch locally. Added the backslash to the line above, ran pip install . --upgrade, and it worked as expected.
API call & Traceback:
>>> mirai_iocs = otx.get_pulse_indicators('58e39804b789b25b15083fc6', limit=219)
Traceback (most recent call last):
File "<input>", line 1, in <module>
mirai_iocs = otx.get_pulse_indicators('58e39804b789b25b15083fc6', limit=219)
File "/usr/local/lib/python2.7/site-packages/OTXv2.py", line 404, in get_pulse_indicators
return self.walkapi(self.create_url(PULSE_DETAILS + str(pulse_id) + "/indicators", limit=limit))
File "/usr/local/lib/python2.7/site-packages/OTXv2.py", line 274, in walkapi
return list(self.walkapi_iter(url, max_page=max_page))
File "/usr/local/lib/python2.7/site-packages/OTXv2.py", line 265, in walkapi_iter
data = self.get(next_page_url)
File "/usr/local/lib/python2.7/site-packages/OTXv2.py", line 112, in get
proxies=self.proxies,
File "/usr/local/lib/python2.7/site-packages/requests/sessions.py", line 501, in get
return self.request('GET', url, **kwargs)
File "/usr/local/lib/python2.7/site-packages/requests/sessions.py", line 488, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python2.7/site-packages/requests/sessions.py", line 609, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python2.7/site-packages/requests/adapters.py", line 487, in send
raise ConnectionError(e, request=request)
ConnectionError: HTTPSConnectionPool(host='otx.alienvault.comapi', port=443): Max retries exceeded with url: /v1/pulses/58e39804b789b25b15083fc6/indicators?limit=219 (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x10c0d5110>: Failed to establish a new connection: [Errno 8] nodename nor servname provided
, or not known',))
As shown above the ConnectionError is failing due to HTTPSConnectionPool(host='otx.alienvault.comapi', port=443) where the host variable is not a valid hostname.
API_V1_ROOT is
"api/v1"
when it looks like it should be"/api/v1"
or requests to the API fail becauseotx.alienvault.comapi
is not a valid hostname for HTTP requests. I'm on Python 2.7.11 just fyi.Simply prepending a backslash to the API_V1_ROOT variable fixed this for me when I reinstalled the latest master branch locally. Added the backslash to the line above, ran
pip install . --upgrade
, and it worked as expected.API call & Traceback:
As shown above the ConnectionError is failing due to
HTTPSConnectionPool(host='otx.alienvault.comapi', port=443)
where the host variable is not a valid hostname.After Patch: