· 8 years ago · Nov 19, 2017, 10:34 PM
1from urllib2 import Request, urlopen
2request = Request("https://api.emergingthreats.net/v1/ips/{80.82.77.139}/urls")
3request.add_header("Authorization", "SECRETKEY")
4result = urlopen(request)
5print result.read()
6
7
8/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 /Users/mani/PycharmProjects/implace/pfpoint.py
9Traceback (most recent call last):
10 File "/Users/mani/PycharmProjects/implace/pfpoint.py", line 4, in <module>
11 result = urlopen(request)
12 File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 154, in urlopen
13 return opener.open(url, data, timeout)
14 File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 435, in open
15 response = meth(req, response)
16 File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 548, in http_response
17 'http', request, response, code, msg, hdrs)
18 File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 473, in error
19 return self._call_chain(*args)
20 File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 407, in _call_chain
21 result = func(*args)
22 File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 556, in http_error_default
23 raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
24urllib2.HTTPError: HTTP Error 400: Bad Request