# Best easy to use python weather api?

**URL:** <https://forums.pimoroni.com/t/best-easy-to-use-python-weather-api/4553>\
**Category:** Support\
**Created:** [April 10, 2017, 5:47pm UTC](https://forums.pimoroni.com/t/best-easy-to-use-python-weather-api/4553 "2017-04-10T17:47:54Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Benhackerman](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/benhackerman/32/2335_2.png) [@Benhackerman](https://forums.pimoroni.com/u/Benhackerman)\
**Post date:** [April 10, 2017, 5:47pm UTC](https://forums.pimoroni.com/t/best-easy-to-use-python-weather-api/4553/1 "2017-04-10T17:47:54Z")

</div>

I am creating a project in witch i use a pi 0 W to power a unicorn hat to shine different colours depending on the outside temperature.

For this all i need is a simple python api that can access uk (more precisely cornish) temperature and a basic weather data (for feature expansions) , it also needs to be easy to use with good documentation.

Any suggestions.

Thanks for any help.

---

<div class="post-metadata">

**Author:** ![MarcJennings](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/marcjennings/32/2142_2.png) [@MarcJennings](https://forums.pimoroni.com/u/MarcJennings)\
**Post date:** [April 11, 2017, 7:48am UTC](https://forums.pimoroni.com/t/best-easy-to-use-python-weather-api/4553/2 "2017-04-11T07:48:30Z")

</div>

You could do a lot worse than to use the Dark sky API at [https://darksky.net/dev/](https://darksky.net/dev/). You get 1000 calls to the API per day for free - more than enough for most uses. Beyond that it is still cost effective. Check the FAQs.  
I use it for a couple of monitoring systems and it works very well.

---

<div class="post-metadata">

**Author:** ![PaulWebster](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/paulwebster/32/6045_2.png) [@PaulWebster](https://forums.pimoroni.com/u/PaulWebster)\
**Post date:** [April 11, 2017, 9:11am UTC](https://forums.pimoroni.com/t/best-easy-to-use-python-weather-api/4553/3 "2017-04-11T09:11:30Z")

</div>

and there is a Python wrapper for DarkSky at [https://github.com/ZeevG/python-forecast.io](https://github.com/ZeevG/python-forecast.io)

---

<div class="post-metadata">

**Author:** ![Benhackerman](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/benhackerman/32/2335_2.png) [@Benhackerman](https://forums.pimoroni.com/u/Benhackerman)\
**Post date:** [April 12, 2017, 9:32am UTC](https://forums.pimoroni.com/t/best-easy-to-use-python-weather-api/4553/4 "2017-04-12T09:32:07Z")

</div>

How do I install the python wrapper?

---

<div class="post-metadata">

**Author:** ![MarcJennings](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/marcjennings/32/2142_2.png) [@MarcJennings](https://forums.pimoroni.com/u/MarcJennings)\
**Post date:** [April 12, 2017, 9:37am UTC](https://forums.pimoroni.com/t/best-easy-to-use-python-weather-api/4553/5 "2017-04-12T09:37:25Z")

</div>

usually, assuming you have the git-core package installed (if not, use “sudo apt-get install git-core” to get it) you’d do something like.

```
git clone https://github.com/ZeevG/python-forecast.io
cd python-forecast.io
sudo python setup.py install

```

to set up the library, and then to use it, import the library in your python script

```
import python-forecast.io

```

Once you’ve done that, you can edit [example.py](http://example.py) with your own data (including the API key you need to get from the service)to get the data you want. In my case, the top of the file looks like this

```
import datetime
import forecastio

def main():
    """
    Run load_forecast() with the given lat, lng, and time arguments.
    """

    api_key = "redacted"

    lat = 53.38
    lng = -1.22
    time = datetime.datetime(2017, 4, 13, 6, 0, 0)

    ...more....

```

and the output looks like this on the console

```
===========Currently Data=========
<ForecastioDataPoint instance: Mostly Cloudy at 2017-04-13 05:00:00>
===========Hourly Data=========
Hourly Summary: Mostly cloudy starting overnight.
<ForecastioDataPoint instance: Partly Cloudy at 2017-04-12 23:00:00>
<ForecastioDataPoint instance: Clear at 2017-04-13 00:00:00>
<ForecastioDataPoint instance: Partly Cloudy at 2017-04-13 01:00:00>
<ForecastioDataPoint instance: Partly Cloudy at 2017-04-13 02:00:00>
<ForecastioDataPoint instance: Partly Cloudy at 2017-04-13 03:00:00>
<ForecastioDataPoint instance: Mostly Cloudy at 2017-04-13 04:00:00>
<ForecastioDataPoint instance: Mostly Cloudy at 2017-04-13 05:00:00>
<ForecastioDataPoint instance: Mostly Cloudy at 2017-04-13 06:00:00>
<ForecastioDataPoint instance: Mostly Cloudy at 2017-04-13 07:00:00>
<ForecastioDataPoint instance: Mostly Cloudy at 2017-04-13 08:00:00>
<ForecastioDataPoint instance: Mostly Cloudy at 2017-04-13 09:00:00>
<ForecastioDataPoint instance: Mostly Cloudy at 2017-04-13 10:00:00>
<ForecastioDataPoint instance: Mostly Cloudy at 2017-04-13 11:00:00>
<ForecastioDataPoint instance: Mostly Cloudy at 2017-04-13 12:00:00>
<ForecastioDataPoint instance: Mostly Cloudy at 2017-04-13 13:00:00>
<ForecastioDataPoint instance: Overcast at 2017-04-13 14:00:00>
<ForecastioDataPoint instance: Overcast at 2017-04-13 15:00:00>
<ForecastioDataPoint instance: Mostly Cloudy at 2017-04-13 16:00:00>
<ForecastioDataPoint instance: Mostly Cloudy at 2017-04-13 17:00:00>
<ForecastioDataPoint instance: Mostly Cloudy at 2017-04-13 18:00:00>
<ForecastioDataPoint instance: Mostly Cloudy at 2017-04-13 19:00:00>
<ForecastioDataPoint instance: Mostly Cloudy at 2017-04-13 20:00:00>
<ForecastioDataPoint instance: Partly Cloudy at 2017-04-13 21:00:00>
<ForecastioDataPoint instance: Partly Cloudy at 2017-04-13 22:00:00>
===========Daily Data=========
Daily Summary: None
<ForecastioDataPoint instance: Mostly cloudy throughout the day. at 2017-04-12 23:00:00>
```

---

<div class="post-metadata">

**Author:** ![PaulWebster](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/paulwebster/32/6045_2.png) [@PaulWebster](https://forums.pimoroni.com/u/PaulWebster)\
**Post date:** [April 12, 2017, 1:49pm UTC](https://forums.pimoroni.com/t/best-easy-to-use-python-weather-api/4553/6 "2017-04-12T13:49:55Z")

</div>

Even easier … from the readme

> Installation

> You should use pip to install python-forecastio.

> To install pip install python-forecastio  
> To remove pip uninstall python-forecastio  
> Simple!

---

<div class="post-metadata">

**Author:** ![Benhackerman](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/benhackerman/32/2335_2.png) [@Benhackerman](https://forums.pimoroni.com/u/Benhackerman)\
**Post date:** [April 12, 2017, 8:20pm UTC](https://forums.pimoroni.com/t/best-easy-to-use-python-weather-api/4553/7 "2017-04-12T20:20:15Z")

</div>

I’ve tried that but it gives me an error

---

<div class="post-metadata">

**Author:** ![PaulWebster](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/paulwebster/32/6045_2.png) [@PaulWebster](https://forums.pimoroni.com/u/PaulWebster)\
**Post date:** [April 12, 2017, 9:17pm UTC](https://forums.pimoroni.com/t/best-easy-to-use-python-weather-api/4553/8 "2017-04-12T21:17:38Z")

</div>

Can you copy/paste what you tried and the responses?

---

<div class="post-metadata">

**Author:** ![Benhackerman](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/benhackerman/32/2335_2.png) [@Benhackerman](https://forums.pimoroni.com/u/Benhackerman)\
**Post date:** [April 13, 2017, 10:26am UTC](https://forums.pimoroni.com/t/best-easy-to-use-python-weather-api/4553/10 "2017-04-13T10:26:34Z")

</div>

![](https://us1.discourse-cdn.com/flex016/uploads/pimoroni/original/2X/9/98948557467af5ab7402a220e3560f56b89dae90.jpg)this happens (sorry bout the reflections )

---

<div class="post-metadata">

**Author:** ![RogueM](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/roguem/32/311_2.png) [@RogueM](https://forums.pimoroni.com/u/RogueM)\
**Post date:** [April 13, 2017, 2:15pm UTC](https://forums.pimoroni.com/t/best-easy-to-use-python-weather-api/4553/11 "2017-04-13T14:15:30Z")

</div>

you need to run the command with elevated privileges:

```
sudo pip install python-forecastio
```
