Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import json
- from urllib2 import Request, urlopen
- def sendRequest(line,action):
- req="https://api.emergingthreats.net/v1/ips/"+line.rstrip()+"/"+action
- request = Request(req)
- request.add_header("Authorization", "sec key")
- result = urlopen(request)
- return result
- Traceback (most recent call last):
- File "/Users/vino/Desktop/all python files/malicious/IPChecking.py", line 31, in <module>
- result = sendRequest(line,"geoloc")
- File "/Users/vino/Desktop/all python files/malicious/IPChecking.py", line 8, in sendRequest
- result = urlopen(request)
- File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 154, in urlopen
- return opener.open(url, data, timeout)
- File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 435, in open
- response = meth(req, response)
- File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 548, in http_response
- 'http', request, response, code, msg, hdrs)
- File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 473, in error
- return self._call_chain(*args)
- File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 407, in _call_chain
- result = func(*args)
- File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 556, in http_error_default
- raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
- urllib2.HTTPError: HTTP Error 403: Forbidden
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement