Skip to content

Instantly share code, notes, and snippets.

Created Oct 26, 2014
What would you like to do?
# Fetch latitude and longitude from freegeoip
import urllib2
import json
def geo(ip=''):
g = urllib2.urlopen('' % ip)
geo = json.loads(''.join(g))
return geo['latitude'], geo['longitude']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment