Skip to content

Instantly share code, notes, and snippets.

@Anton-2
Anton-2 / get_location.py
Created September 17, 2013 19:56
Hack used in pythonista to read the device geolocation info. This version adds some error handling, and the ability to control the geo location service options ( see http://diveintohtml5.info/geolocation.html ) The fake http protocol is very crude, it may be a better opttion to use python's BaseHTTPServer.
import socket
import webbrowser
import datetime
import json
from collections import namedtuple
class GeoLocationError(Exception):
def __init__(self, code, message):