Skip to content

Instantly share code, notes, and snippets.

@defeo
Created Oct 26, 2014
Embed
What would you like to do?
# 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