Created
October 26, 2014 13:08
-
-
Save defeo/debcc9ba4f0f3781423e to your computer and use it in GitHub Desktop.
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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment