Pywapi is a Python wrapper around different weather APIs Pywapi Pip Homepage
root@edison:~# vi apis.py
#!/usr/bin/python
import pywapi
import time
def functionApiWeather():
data = pywapi.get_weather_from_weather_com('MXJO0043', 'metric')
message = data['location']['name']
message = message + ", Temperature " + data['current_conditions']['temperature'] + " C"
message = message + ", Atmospheric Pressure " + data['current_conditions']['barometer']['reading'][:-3] + " mbar"
return message
if __name__ == '__main__':
while True:
print "API Weather: %s " % functionApiWeather()
time.sleep(5)
# End of File
root@edison:~# python main.py
API Weather: Guadalajara, JO, Mexico, Temperature 18 C, Atmospheric
API Weather: Guadalajara, JO, Mexico, Temperature 18 C, Atmospheric
...