Created
January 29, 2020 02:26
-
-
Save e96031413/fabb571506b8f34bdd79b7d7ab79ecad to your computer and use it in GitHub Desktop.
How To find the location info with geocoder
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
#pip install geocoder | |
import geocoder | |
g = geocoder.ip('me') | |
g.latlng | |
#Out[1]: [22.0063, 120.3933] | |
g.address | |
#Out[2]: 'Kaohsiung, Takao, TW' | |
g.geojson | |
#Out[3]:{'type': 'FeatureCollection', 'features': | |
[{'type': 'Feature', 'properties': {'address': 'Kaohsiung, Takao, TW', | |
'city': 'Kaohsiung', 'country': 'TW', 'hostname': 'X.X.X.X', | |
'ip': 'X.X.X.X', 'lat': 22.0063, 'lng': 120.3933, 'ok': True, | |
'org': 'AS7532 DigiCentre Company Limited,', | |
'raw': {'ip': 'X.X.X.X', 'hostname': 'X.X.X.X', | |
'city': 'Kaohsiung', 'region': 'Takao', 'country': | |
'TW', 'loc': '22.0063,120.3133', | |
'org': 'AS7532 DigiCentre Company Limited,', | |
'timezone': 'Asia/Taipei', 'readme': 'https://ipinfo.io/missingauth'}, | |
'state': 'Takao', 'status': 'OK'}, | |
'geometry': {'type': 'Point', 'coordinates': [120.3933, 22.0063]}}]} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment