Last active
December 9, 2015 23:39
-
-
Save corvax19/4346134 to your computer and use it in GitHub Desktop.
gist_weather
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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