> For the complete documentation index, see [llms.txt](https://theiotlearninginitiative.gitbook.io/internetofthings101/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://theiotlearninginitiative.gitbook.io/internetofthings101/architecture/cloud-computing/application-programming-interface/labs.md).

# Labs

> Pywapi is a Python wrapper around different weather APIs [Pywapi Pip Homepage](https://pypi.python.org/pypi/pywapi)

```bash
root@edison:~# vi apis.py
```

```python
#!/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
```

```bash
root@edison:~# python main.py 
API Weather: Guadalajara, JO, Mexico, Temperature 18 C, Atmospheric 
API Weather: Guadalajara, JO, Mexico, Temperature 18 C, Atmospheric 
...
```
