Github url

by chubin

chubin /

:partly_sunny: The right way to check the weather

12.5K Stars 643 Forks Last release: Not found Apache License 2.0 883 Commits 0 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here: — the right way to check the weather! is a console-oriented weather forecast service that supports various information representation methods like terminal-oriented ANSI-sequences for console HTTP clients (curl, httpie, or wget), HTML for web browsers, or PNG for graphical viewers. uses wego for visualization and various data sources for weather forecast information.

You can see it running here:


You can access the service from a shell or from a Web browser like this:

$ curl Weather for City: Paris, France \ / Clear .-. 10 – 11 °C ― ( ) ― ↑ 11 km/h `-’ 10 km / \ 0.0 mm

Here is an actual weather report for your location (it's live!):

Weather Report

(It's not your actual location - GitHub's CDN hides your real IP address with its own IP address, but it's still a live weather report in your language.)

Or in PowerShell:


Want to get the weather information for a specific location? You can add the desired location to the URL in your request like this:

$ curl $ curl $ curl

If you omit the location name, you will get the report for your current location based on your IP address.

Use 3-letter airport codes in order to get the weather information at a certain airport:

$ curl # Weather for IATA: muc, Munich International Airport, Germany $ curl # Weather for IATA: ham, Hamburg Airport, Germany

Let's say you'd like to get the weather for a geographical location other than a town or city - maybe an attraction in a city, a mountain name, or some special location. Add the character


before the name to look up that special location name before the weather is then retrieved:

$ curl $ curl $ curl

For these examples, you'll see a line below the weather forecast output that shows the geolocation results of looking up the location:

Location: Vostok Station, станция Восток, AAT, Antarctica [-78.4642714,106.8364678] Location: Tour Eiffel, 5, Avenue Anatole France, Gros-Caillou, 7e, Paris, Île-de-France, 75007, France [48.8582602,2.29449905432] Location: Kilimanjaro, Northern, Tanzania [-3.4762789,37.3872648]

You can also use IP-addresses (direct) or domain names (prefixed with


) to specify a location:

$ curl $ curl

To get detailed information online, you can access the /:help page:

$ curl

Weather Units

By default the USCS units are used for the queries from the USA and the metric system for the rest of the world. You can override this behavior by adding




to a URL like this:

$ curl $ curl

Supported output formats and views currently supports five output formats:

  • ANSI for the terminal;
  • Plain-text for the terminal and scripts;
  • HTML for the browser;
  • PNG for the graphical viewers;
  • JSON for scripts and APIs;
  • Prometheus metrics for scripts and APIs.

The ANSI and HTML formats are selected basing on the User-Agent string. The PNG format can be forced by adding


to the end of the query:

$ wget

You can use all of the options with the PNG-format like in an URL, but you have to separate them with


instead of





$ wget\_0tqp\_lang=fr.png

Useful options for the PNG format:

  • t
    for transparency (
  • transparency=0..255 for a custom transparency level.

Transparency is a useful feature when weather PNGs are used to add weather data to pictures:

$ convert source.jpg 

In this example:
  • source.jpg
    • source file;
  • target.jpg
    • target file;
  • Oymyakon
    • name of the location;
  • tqp0
    • options (recommended).

Picture with weather data

You can embed a special widget, that displays the weather condition for the current or a selected location, into a HTML page using the wttr-switcher. That is how it looks like: wttr-switcher-example or on a real world web site:

Embedded example at

One-line output

For one-line output format, specify additional URL parameter



$ curl Nuremberg: 🌦 +11⁰C

Available preconfigured formats: 1, 2, 3, 4 and the custom format using the percent notation (see below).

You can specify multiple locations separated with


(for repeating queries):

$ curl Nuremberg: 🌦 +11⁰C

Or to process all this queries at once:

$ curl -s '{Nuremberg,Hamburg,Berlin}?format=3' Nuremberg: 🌦 +11⁰C Hamburg: 🌦 +8⁰C Berlin: 🌦 +8⁰C

To specify your own custom output format, use the special



c Weather condition, C Weather condition textual name, h Humidity, t Temperature (Actual), f Temperature (Feels Like), w Wind, l Location, m Moonphase 🌑🌒🌓🌔🌕🌖🌗🌘, M Moonday, p precipitation (mm), o Probability of Precipitation, P pressure (hPa), D Dawn\*, S Sunrise\*, z Zenith\*, s Sunset\*, d Dusk\*. (\*times are shown in the local timezone)

So, these two calls are the same:

$ curl London: ⛅️ +7⁰C $ curl"%l:+%c+%t\n" London: ⛅️ +7⁰C

Keep in mind, that when using in


, you have to escape




, i.e. write there


instead of



In programs, that are querying the service automatically (such as tmux), it is better to use some reasonable update interval. In tmux, you can configure it with



If several,


separated locations, are specified in the query, specify update period as an additional query parameter



set -g status-interval 60 WEATHER='#(curl -s\?format\="%%l:+%%c%%20%%t%%60%%w&period=60")' set -g status-right "$WEATHER ..." in tmux status bar

To see emojis in terminal, you need:

  1. Terminal support for emojis (was added to Cairo 1.15.8);
  2. Font with emojis support.

For the Emoji font, we recommend Noto Color Emoji, and a good alternative option would be the Emoji One font; both of them support all necessary emoji glyphs.

Font configuration:

$ cat ~/.config/fontconfig/fonts.conf<?xml version="1.0" encoding="UTF-8"?><fontconfig>
      <family>Noto Color Emoji</family>
      <family>Noto Color Emoji</family>
      <family>Noto Color Emoji</family>

(to apply the configuration, run

fc-cache -f -v


Data-rich output format

In the experimental data-rich output format, that is available under the view code


, a lot of additional weather and astronomical information is available:

  • Temperature, and precepetation changes forecast throughout the days;
  • Moonphase for today and the next three days;
  • The current weather condition, temperature, humidity, windspeed and direction, pressure;
  • Timezone;
  • Dawn, sunrise, noon, sunset, dusk time for he selected location;
  • Precise geographical coordinates for the selected location.
$ curlünchen


$ curlünchen?format=v2

or, if you prefer Nerd Fonts instead of Emoji,


(day) or



$ curlünchen

data-reach output format

(The mode is experimental, and it has several limitations currently:

  • It works only in terminal;
  • Only English is supported).

Currently, you need some tweaks for some terminals, to get the best possible visualization.


Depending on your configuration you might be taking all steps, or only a few. URXVT currently doesn't support emoji related fonts, but we can get almost the same effect using Font-Symbola. So add to your


file the following line:


You can add it after your preferred font and it will only show up when required. Then, if you see or feel like you're having spacing issues, add this:

URxvt.letterSpace: 0

For some reason URXVT sometimes stops deciding right the word spacing and we need to force it this way.

The result, should look like:

URXVT Emoji line

Different output formats

JSON output

The JSON format is a feature providing access to data through an easy-to-parse format, without requiring the user to create a complex script to reinterpret's graphical output.

To fetch information in JSON format, use the following syntax:

$ curl

This will fetch information on the Detroit region in JSON format. The j1 format code is used to allow for the use of other layouts for the JSON output.

The result will look something like the following:

json { "current\_condition": [{ "FeelsLikeC": "25", "FeelsLikeF": "76", "cloudcover": "100", "humidity": "76", "observation\_time": "04:08 PM", "precipMM": "0.2", "pressure": "1019", "temp\_C": "22", "temp\_F": "72", "uvIndex": 5, "visibility": "16", "weatherCode": "122", "weatherDesc": [ { "value": "Overcast" }], "weatherIconUrl": [{ "value": "" }], "winddir16Point": "NNE", "winddirDegree": "20", "windspeedKmph": "7", "windspeedMiles": "4" } ], ...

Most of these values are self-explanatory, aside from


. The


is an enumeration which you can find at either the WorldWeatherOnline website or in the source code.

Prometheus Metrics Output

The Prometheus Metrics format is a feature providing access to data through an easy-to-parse format for monitoring systems, without requiring the user to create a complex script to reinterpret's graphical output.

To fetch information in Prometheus format, use the following syntax:

$ curl

This will fetch information on the Detroit region in Prometheus Metrics format. The


format code is used to allow for the use of other layouts for the Prometheus Metrics output.

A possible configuration for Prometheus could look like this:

- job\_name: 'wttr\_in\_detroit' static\_configs: - targets: [''] metrics\_path: '/Detroit' params: format: ['p1']

The result will look something like the following:

# HELP temperature\_feels\_like\_celsius Feels Like Temperature in Celsius temperature\_feels\_like\_celsius{forecast="current"} 7 # HELP temperature\_feels\_like\_fahrenheit Feels Like Temperature in Fahrenheit temperature\_feels\_like\_fahrenheit{forecast="current"} 45 [truncated]


Moon phases can also be used to check the phase of the Moon. This example shows how to see the current Moon phase in the full-output mode:

$ curl

Get the Moon phase for a particular date by adding



$ curl[email protected]

The Moon phase information uses pyphoon as its backend.

To get the moon phase information in the online mode, use



$ curl 🌖

Keep in mid that the Unicode representation of moonphases suffers 2 caveats:

  • With some fonts, the representation


is ambiguous, for it either seem almost-shadowed or almost-lit, depending on whether your terminal is in light mode or dark mode. Relying on colored fonts like


works around this problem.

The representation


is also ambiguous, for it means "last quarter" in northern hemisphere, but "first quarter" in souther hemisphere. It also means nothing in tropical zones. This is a limitation thatUnicode is aware about. But it has not been worked around at


See #247, #364 for the corresponding tracking issues, and pyphoon#1 for pyphoon. Any help is welcome.

Internationalization and localization supports multilingual locations names that can be specified in any language in the world (it may be surprising, but many locations in the world don't have an English name).

The query string should be specified in Unicode (hex-encoded or not). Spaces in the query string must be replaced with



$ curlстанция+Восток Weather report: станция Восток Overcast .--. -65 – -47 °C .-( ). ↑ 23 km/h (\_\_\_.\_\_)\_\_) 15 km 0.0 mm

The language used for the output (except the location name) does not depend on the input language and it is either English (by default) or the preferred language of the browser (if the query was issued from a browser) that is specified in the query headers (



The language can be set explicitly when using console clients by using command-line options like this:

curl -H "Accept-Language: fr" http GET Accept-Language:ru

The preferred language can be forced using the



$ curl

The third option is to choose the language using the DNS name used in the query:

$ curl is currently translated into 54 languages, and the number of supported languages is constantly growing.

See /:translation to learn more about the translation process, to see the list of supported languages and contributors, or to know how you can help to translate in your language.

Queries to in various languages

Windows Users

There are currently two Windows related issues that prevent the examples found on this page from working exactly as expected out of the box. Until Microsoft fixes the issues, there are a few workarounds. To circumvent both issues you may use a shell such as


on the Windows Subsystem for Linux (WSL) or read on for alternative solutions.

Garbage characters in the output

There is a limitation of the current Win32 version of


. Until the Win32 curl issue is resolved and rolled out in a future Windows release, it is recommended that you use Powershell’s


command instead: -


Missing or double wide diagonal wind direction characters

The second issue is regarding the width of the diagonal arrow glyphs that some Windows Terminal Applications such as the default


use. At the time of writing this,




and Terminal Applications built on top of ConEmu such as Cmder (


) use these double-wide glyphs by default. The result is the same with all of these programs, either a missing character for certain wind directions or a broken table in the output or both. Some third-party Terminal Applications have addressed the wind direction glyph issue but that fix depends on the font and the Terminal Application you are using. One way to display the diagonal wind direction glyphs in your Terminal Application is to use Windows Terminal which is currently available in the Microsoft Store. Windows Terminal is currently a preview release and will be rolled out as the default Terminal Application in an upcoming release. If your output is still skewed after using Windows Terminal then try maximizing the terminal window. Another way you can display the diagonal wind direction is to swap out the problematic characters with forward and backward slashes as shown here.


To install the application:

  1. Install external dependencies
  2. Install Python dependencies used by the service
  3. Configure IP2Location (optional)
  4. Get a WorldWeatherOnline API and configure wego
  5. Configure
  6. Configure the HTTP-frontend service

Install external dependencies has the following external dependencies:

  • golang, wego dependency
  • wego, weather client for terminal

After you install golang, install



$ go get -u $ go install

Install Python dependencies

Python requirements:

  • Flask
  • geoip2
  • geopy
  • requests
  • gevent

If you want to get weather reports as PNG files, you'll also need to install:

  • PIL
  • pyte (>=0.6)
  • necessary fonts

You can install most of them using



Some python package use LLVM, so install it first:

$ apt-get install llvm-7 llvm-7-dev



is used:

$ virtualenv -p python3 ve $ ve/bin/pip3 install -r requirements.txt $ ve/bin/python3 bin/

Also, you need to install the geoip2 database. You can use a free database GeoLite2 that can be downloaded from (

Configure IP2Location (optional)

If you want to use the IP2location service for IP-addresses that are not covered by GeoLite2, you have to obtain a API key of that service, and after that save into the



$ echo 'YOUR\_IP2LOCATION\_KEY' \> ~/.ip2location.key

If you don't have this file, the service will be silently skipped (it is not a big problem, because the MaxMind database is pretty good).

Get a WorldWeatherOnline key and configure wego

To get a WorldWeatherOnline API key, you must register here:

After you have a WorldWeatherOnline key, you can save it into the WWO key file:


Also, you have to specify the key in the



$ cat ~/.wegorc { "APIKey": "00XXXXXXXXXXXXXXXXXXXXXXXXXXX", "City": "London", "Numdays": 3, "Imperial": false, "Lang": "en" }



parameter in


is ignored.


Configure the following environment variables that define the path to the local

installation, to the GeoLite database, and to the


installation. For example:

export WTTR\_MYDIR="/home/igor/" export WTTR\_GEOLITE="/home/igor/" export WTTR\_WEGO="/home/igor/go/bin/wego" export WTTR\_LISTEN\_HOST="" export WTTR\_LISTEN\_PORT="8002"

Configure the HTTP-frontend service

It's recommended that you also configure the web server that will be used to access the service:

server { listen [::]:80; server\_name \*; access\_log /var/log/nginx/ main; error\_log /var/log/nginx/; location / { proxy\_pass; proxy\_set\_header Host $host; proxy\_set\_header X-Real-IP $remote\_addr; proxy\_set\_header X-Forwarded-For $remote\_addr; client\_max\_body\_size 10m; client\_body\_buffer\_size 128k; proxy\_connect\_timeout 90; proxy\_send\_timeout 90; proxy\_read\_timeout 90; proxy\_buffer\_size 4k; proxy\_buffers 4 32k; proxy\_busy\_buffers\_size 64k; proxy\_temp\_file\_write\_size 64k; expires off; } }

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.