Advertisement
Guest User

Untitled

a guest
Dec 10th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.51 KB | None | 0 0
  1. import json
  2. from urllib2 import Request, urlopen
  3.  
  4. def sendRequest(line,action):
  5.     req="https://api.emergingthreats.net/v1/ips/"+line.rstrip()+"/"+action
  6.     request = Request(req)
  7.     request.add_header("Authorization", "sec key")
  8.     result = urlopen(request)
  9.     return result
  10.  
  11.  
  12. Traceback (most recent call last):
  13.   File "/Users/vino/Desktop/all python files/malicious/IPChecking.py", line 31, in <module>
  14.     result = sendRequest(line,"geoloc")
  15.   File "/Users/vino/Desktop/all python files/malicious/IPChecking.py", line 8, in sendRequest
  16.     result = urlopen(request)
  17.   File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 154, in urlopen
  18.     return opener.open(url, data, timeout)
  19.   File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 435, in open
  20.     response = meth(req, response)
  21.   File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 548, in http_response
  22.     'http', request, response, code, msg, hdrs)
  23.   File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 473, in error
  24.     return self._call_chain(*args)
  25.   File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 407, in _call_chain
  26.     result = func(*args)
  27.   File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 556, in http_error_default
  28.     raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
  29. urllib2.HTTPError: HTTP Error 403: Forbidden
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement