MertcanGokgoz

ipinfo.io basic usage

Dec 15th, 2018
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. import requests
  2.  
  3. IP='1.1.1.1'
  4. API_URL = 'https://ipinfo.io/' + IP
  5. TOKEN = "<TOKEN>"
  6.  
  7.  
  8. headers = {
  9.     'user-agent': 'CliClient/Python3.7',
  10.     'accept': 'application/json',
  11.     'authorization': 'Bearer {}'.format(TOKEN)
  12. }
  13.  
  14. request = requests.get(API_URL ,headers=headers)
  15. for req in request:
  16.     print(req.decode("utf-8"))
Advertisement
Add Comment
Please, Sign In to add comment