Github pages Server-Client Unix

Weather reports from your terminal with curl

What is curl?

curl is a program that is included in your Mac OSX distribution used for transferring data from or to a server. It uses many supported protocols (HTTP, HTTPS, FTP, SMTP and more).

Do you have curl?

Find the location of the curl program (executable) with $ which curl. This will return /usr/bin/curl if you’re on Mac.

How do I use curl?

A simple http GET request can be made like this:

$ curl

How to deal with 301 redirect 

Notice that you get a 301 message that is address has been “moved”. You can add the flag -L, --location (choose either) to “follow” redirects

$ curl -L

$ curl --location

How do I use curl to get the weather?

There is a service called wttr that is set up to return weather reports when you curl their service. This time we will use http for added security.

For a full local weather report:

$ curl

Should I use http?

For todays weather report:

$ curl

You can also specify a city or ski resort.

For todays weather report for New York:


Check if its snowy in your favorite ski resort – Charlotte Pass, Snowy Monaro, NSW, Australia

* Notice that wttr is returning special terminal characters to change the color. You can save these to examine this in your text editor.

Congrats! You got the weather!

Note that you can curl any web service, even ones you build yourself.

Want to build your own weather service? We’ll do that next in the Part II of this series.

Bonus Section:

Can I curl my own websites?

Yes! If you followed our github pages tutorial you’ll find you can curl your own website AND YOUR STATIC FILES

$ curl -L  <- website

$ curl -L <- static txt file


*Update – this post got onto the hackernews front page and since then the API for has been down. **Update, the API is back up!

7 replies on “Weather reports from your terminal with curl”

Couple nits to pick:

1. The URL should be – HTTPS is useful for anything that crosses the web.

2. Some of the characters it writes are definitely Unicode, not ASCII.

Oh no, this is the first thing i’ve posted to hackernews and I think that pushed it over the limit. I should apologize to igor_chubin on twitter.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s