[CentralOH] Code from last night's Beginner's Python talk

Eric Floehr eric at intellovations.com
Mon Oct 5 21:24:26 CEST 2015


Pete,

Yes! But the free tier is limited to 500 requests per day, and there is
some data that isn't available.

More here: http://www.wunderground.com/weather/api/

Best Regards,
Eric


On Thu, Oct 1, 2015 at 4:24 PM, Peter Carswell <pcarswell.1 at gmail.com>
wrote:

> Eric,
>
> I have forgotten from your discussion, does the free wunderground
> membership provide the json/xml service?
>
> pete
>
> On Tue, Sep 29, 2015 at 2:50 PM, Eric Floehr <eric at intellovations.com>
> wrote:
>
>> import urllib2
>>
>> # The API url to call
>> key = 'f6a..........15a'
>> url = '
>> http://api.wunderground.com/api/{key}/geolookup/conditions/q/France/Paris.json'.format(key=key)
>>
>> # Open the page and store as a string
>> page = urllib2.urlopen(url)
>> json_string = page.read()
>> page.close()
>>
>> # Read the string and parse as JSON data
>> data = json.loads(json_string)
>>
>> # Pull out information from the JSON data
>> location = data['location']['city']
>> obs = data['current_observation']
>> temp_f = obs['temp_f']
>> condition = obs['weather']
>>
>> print("In {loc} it is {temp:.0f} and {cond}".format(loc=location,
>> temp=temp_f, cond=condition))
>>
>>
>> _______________________________________________
>> CentralOH mailing list
>> CentralOH at python.org
>> https://mail.python.org/mailman/listinfo/centraloh
>>
>>
>
> _______________________________________________
> CentralOH mailing list
> CentralOH at python.org
> https://mail.python.org/mailman/listinfo/centraloh
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/centraloh/attachments/20151005/d6894396/attachment.html>


More information about the CentralOH mailing list