Skip to content

Instantly share code, notes, and snippets.

@Allwin12
Created June 5, 2020 17:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Allwin12/be0f8813573edacfb207147e11e5a26f to your computer and use it in GitHub Desktop.
Save Allwin12/be0f8813573edacfb207147e11e5a26f to your computer and use it in GitHub Desktop.
from requests import get
import json
url = 'http://ipinfo.io/json'
response = get(url)
data = json.loads(response.text)
city = data['city']
region = data['region']
country = data['country']
postal = data['postal']
timezone = data['timezone']
ip = data['ip']
print("ip:", ip)
print("city:", city)
print("region:", region),
print("country:", country)
print("postal:", postal)
print("timezone", timezone)
@imraneshanbd
Copy link

Thanks
Its Working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment