Skip to content

Instantly share code, notes, and snippets.

@drdrang drdrang/
Created Jan 9, 2014

What would you like to do?
A Pythonista script that gets the address, latitude, and longitude and sends them to Drafts.
import sys
import location, time
import urllib, webbrowser
# Handle argument, if present.
a = sys.argv[1]
except IndexError:
a = ''
# Get the GPS info.
loc = location.get_location()
addr = location.reverse_geocode(loc)
# Assemble the output.
spot = '''%s%s
%s, %s %s
%.4f, %.4f''' % \
(a, addr[0]['Street'],
addr[0]['City'], addr[0]['State'], addr[0]['ZIP'],
loc['latitude'], loc['longitude'])
# Send output to Drafts."drafts://x-callback-url/create?text=" + urllib.quote(spot.encode('utf-8')))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.