Created
December 31, 2015 07:26
-
-
Save zahodi/927e14fc1c74d565960e to your computer and use it in GitHub Desktop.
wunderground
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
#!/usr/bin/env ruby | |
require 'open-uri' | |
require 'json' | |
open('http://api.wunderground.com/api/key/geolookup/conditions/q/WA/Seattle.json') do |f| | |
json_string = f.read | |
parsed_json = JSON.parse(json_string) | |
location = parsed_json['location']['city'] | |
temp_f = parsed_json['current_observation']['temp_f'] | |
print "Current temperature in #{location} is: #{temp_f}\n" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment