book collections email follower instructable user

Dark Sky specializes in weather forecasting and visualization. The coolest aspect of Dark Sky is their weather API that we can use to retrieve the weather data from almost anywhere in the world. It's not just weather is rainy or sunny but temperature, dew point, wind gust, humidity, precipitation, pressure, UV index, and more, all easily available for wherever you want, whenever you want.

Let's learn how to use Dark Sky's super-simple API. If you are new to using API's I promise you this is going to be really easy! And if you've used API's before then I hope we can teach you something new with the code we've used.

What you will need for this project:

Step 1: Getting Started

We’ve already put in a lot of the leg work for you putting the code together and organizing the information. We’ll just need you to make a few adjustments along the way. If you want a bit of a challenge make some changes to our code and what weather data is sent, there is limitless possibilities!

To retrieve all of the things we’ve prepared for you, you’ll need to clone the repository from GitHub. GitHub is a service that allows us to store, revise, and manage projects like this. You will want to run this script on a dedicated device. A Raspberry Pi is a perfect option to run applications like this tutorial.

To clone the repository all we need to do is go into our Pi’s terminal, or your computers terminal that is SSH’d into your pi and type this command:

$ git clone   

Hit enter and you’ll see this information:

Cloning into 'darksky'...
remote: Counting objects: 2, done.
remote: Total 2 (delta 0), reused 0 (delta 0), pack-reused 2
Unpacking objects: 100% (2/2), done.
Checking connectivity... done. 

Once you see this then congrats, you’ve successfully cloned the GitHub Repo and have all of the necessary files to build this project. Before we move on to the next step, let’s take some time to explore around this directory and learn a few basic command line commands.

Type in the command below into your terminal:

 $ ls 

This command lists everything that’s available in the directory that you’re currently in. This list shows that our GitHub Repo has been successfully cloned into our directory under the name “darksky.” Let’s take a look at what’s in that directory. To move to a directory, all you need to do is type “cd” and then type the name of the directory that you wish to go to.

In this case, we’ll type:

 $ cd darksky 

Once we hit enter, you’ll see that we’re now in the darksky directory. Let’s type "ls" again to see what files we’ve installed on our pi. ... 

Here we see the we’ve got our readme document and python files. Let’s take a look at using the "nano" command. The nano command allows us to open up the nano text editor where we have all of our python code for each segment of this project. Go ahead and type:

$ nano 

Here you can see all of the code we’ve prepared for you for this project. We’re not going to make any changes to this document just yet, but feel free to scroll around and see what we’re going to be doing later in this tutorial.

mrkldwg1016 months ago
I'm too cheap to pay 10bucks a month for an "Initial State account". Before I dive in, are there other options for displaying the data? I'm a bit of a novice, so any advice would be great!
elizabethna (author)  mrkldwg1011 month ago
There are definitely other options out there. People always mention Grafana but you still have to host that yourself.
marlin_maker6 months ago
That appears to be a nice service, thanks! I downloaded the android app but widgets and stuff require pro memebership. Am I assming correct, that using the API is not limited to basic functions?
elizabethna (author)  marlin_maker6 months ago
I cannot confirm that the Dark Sky API is available in their app or not. I always have used on a desktop because it requires a different sign in thank just using Dark Sky for weather. Their API is free though as long as you don't exceed 1000 API calls per day.