This file contains hidden or 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
| # Fetch latitude and longitude from freegeoip | |
| import urllib2 | |
| import json | |
| def geo(ip=''): | |
| g = urllib2.urlopen('http://freegeoip.net/json/%s' % ip) | |
| geo = json.loads(''.join(g)) | |
| return geo['latitude'], geo['longitude'] | |
| geo() |
NewerOlder