Use Pythonista to Get Weather of Current Location into Drafts App

My quest began when I began using Drafts app (among many other ways) to keep a fishing log. I created a TextExpander fill-in snippet to quickly enter what (if anything) was caught, the date, the type of lure(s) used, etc. I really wanted to automate adding the weather conditions as well, but alas, my search for that solution turned up nothing…until yesterday.

It started when @drdrang shared a Pythonista script to leverage the location inside iOS. Later he shared another version, from @hiilppp.

Armed with that knowledge and a rudimentary knowledge of the API, I set off to steal crib some Python usage of their API. Enter @jayhickey and his PySky script. While written for the v1 Dark Skies API, it gave me enough Python to convert to the new v2 of

The result?

original gist

This version simply grabs the current weather summary and temperature from your current location, meant to be used with @draftsapp as a URL action pythonista : / / py_forecast?action=run&argv=[[draft]]. Dr. Drang suggests using New From Gist, however I had better success using iOctocat. There is an “open in…” dialog when viewing your gists or starred gists, and pick Pythonista.

Certainly for my fishing log I am expanding on this to include wind, sunrise and set times as well as the recently added moon phase. I figured a more generic version would be best shared, but please do not hesitate to leave a comment or ask me a question on Twitter @miklb. I’ll do my best to help, as I’m indebted to the aforementioned gents for sharing their code and helping in the first place.