Created
June 5, 2020 17:56
-
-
Save Allwin12/be0f8813573edacfb207147e11e5a26f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks
Its Working