Skip to content

Instantly share code, notes, and snippets.

@corvax19
Last active December 9, 2015 23:39
Show Gist options
  • Save corvax19/4346134 to your computer and use it in GitHub Desktop.
Save corvax19/4346134 to your computer and use it in GitHub Desktop.
gist_weather
from urllib import urlopen;
import json, sys;
url = "http://openweathermap.org/data/2.1/find/name?q=" + city;
t = json.load(urlopen(url))['list'][0]['main']['temp'] - 273.15;
print t;
@corvax19
Copy link
Author

bash script with city as a command line argument:

!/bin/env bash

python <<< echo "city = \"$1\";"; curl -Ls https://gist.github.com/raw/4346134/760250ba024bfc76a2e5a8ec0725c9b05cde9a48/gistfile1.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment