Python Makefile Batchfile Shell
Latest commit cb31cce Jan 31, 2017 @csparpa committed on GitHub Release 2.6.1 (#174)
* Set a test API key (the one in the API call examples from OWM API website)

* Try to fix Travis Virtualenv support for Py32

* Fix again

* Bump to version 2.3.1

* Don't commit coverage file

* Dockerfile (#106)

* First attempt

* Guide

* Fix Dockerfile and docs

* Update docs

* Change URL of documentation to comply with new readthedocs domain

* Backporting from master branch

* Refactor integration tests to use the API key specified in

* Fix ValueError then sunrise_time & sunset time is less than zero when there is a polar day

* Fix ValueError then sunrise_time & sunset time is less than zero when there is a polar day

* Fix ValueError then sunrise_time & sunset time is less than zero when there is a polar day

* Fix ValueError then sunrise_time & sunset time is less than zero when there is a polar day

* Fix ValueError then sunrise_time & sunset time is less than zero when there is a polar day

* Messed up with Git... sunrise/sunset fix from #109 is OK now

* Sometimes Wind data is None

Hello !
I'm useing Homeassistant, and sometimes I got the following error:
Traceback (most recent call last):
  File "/home/titilambert/gits/domo/homeassitant/env/lib/python3.4/site-packages/homeassistant/helpers/", line 98, in _setup_platform
  File "/home/titilambert/gits/domo/homeassitant/env/lib/python3.4/site-packages/homeassistant/components/sensor/", line 70, in setup_platform
    dev.append(OpenWeatherMapSensor(data, variable, unit))
  File "/home/titilambert/gits/domo/homeassitant/env/lib/python3.4/site-packages/homeassistant/components/sensor/", line 94, in __init__
  File "/home/titilambert/gits/domo/homeassitant/env/lib/python3.4/site-packages/homeassistant/components/sensor/", line 114, in update
  File "/home/titilambert/gits/domo/homeassitant/env/lib/python3.4/site-packages/homeassistant/util/", line 289, in wrapper
    result = method(*args, **kwargs)
  File "/home/titilambert/gits/domo/homeassitant/env/lib/python3.4/site-packages/homeassistant/components/sensor/", line 179, in update
  File "/home/titilambert/gits/domo/homeassitant/config/deps/pyowm/webapi25/", line 432, in three_hours_forecast_at_coords
    forecast = self._parsers['forecast'].parse_JSON(json_data)
  File "/home/titilambert/gits/domo/homeassitant/config/deps/pyowm/webapi25/", line 66, in parse_JSON
    for item in d['list']]
  File "/home/titilambert/gits/domo/homeassitant/config/deps/pyowm/webapi25/", line 66, in <listcomp>
    for item in d['list']]
  File "/home/titilambert/gits/domo/homeassitant/config/deps/pyowm/webapi25/", line 462, in weather_from_dictionary
    wind = d['wind'].copy()
AttributeError: 'NoneType' object has no attribute 'copy'

This patch fixes this error

* Regression test for #110

* update with new contributor

* Fixes for #110 and  #114

* Forgot...

* Were missing

* Bump to version 2.3.2

* How to install multiple python versions

* Feature/#100 python34 support (#118)

* Fix failing test on py32

* update

* fix wrong command

* Ran all tests against Python3.4 and Python3.5 using tox

* Forgot to align Travis as well

* added weather_history_at_coords (#89)

* Add txemi and sorted alphabetically

* Unit tests for method: weather_history_at_coords

* A bit too much stuff passed in as params :-p

* Feature/#121 datetime switch (#122)

* A bit too much stuff passed in as params :-p

* Now you can get reference/reception times as Python datetime.datetime objects as well

* Update

* hoorayyy!

* Added support for unicode place names (#86)

* Update

* Better checks for visibility distance - credits to @dstmar

* Feature/#112 weather by ids (#123)

* improve test that sometimes fails (on very busy machines)

* Added OWM25 method "weather_at_ids"

* Vast refactoring

* Update city ID files and prepare for release 2.4.0

* Back ported from master branch

* Slack team

* Possible fix for Unicode names (#127)

* Update link to OWM API docs

* Add timezone info (#128)

* tests and doc for string/unicode-handling functions in OWM25

* Feature/#93 uv index api (#131)

* New entity: UVIndex, along with unit tests and XMLNS

* New exception for 401 erorrs

* JSON parser for UVIndex instances

* More utils: last_month, last_year, next_month, next_year

* Add "interval" attribute to UVIndex

* Wired new HTTP client for UV API subset; a bit of refactoring

* tests for uvindex_around_coords

* Add missing location to print

* Better exception handling

* Intergation test

* Ooops

* Feature/#129 air pollution api (#134)

* COIndex entity and tests

* Change XML schema and fix tests

* Fix CO sample key: had to be "value" instead of "vmr"

* COIndexParser and test

* Typo

* HTTP Air Pollution data client and tests

* cut 'n' paste leftovers

* Refactoring: we're getting too verbose, man!

* More refactoring

* OWM method for polling CO and test

* Fix docs

* Fix mess about reception_time: now UVIndex entities have both a reference_time and a reception_time

* Same fix: reference_time and reception_time are now available (with proper semantic) on COIndex

* Add is_forecast method to COIndex

* fix test

* cleaner

* Ozone entity and OzoneParser

* Integation tests updated with air pollution airpoints check

* Add ozone_around_coords method to OWM25 and patched tests along

* Fix bug: it was failing due to missing location sting

* Better exception raising

* Improved some integration tests

* better indentation

* Slight change

* Update version, prepare for dumping version

* Remove dead code

* Docstring fixes

* Fix docstrings more

* Fix erorr

* Improve dockerfile

* Backport from master branch

* #130 done (#139)

* Feature/#140 add zip code method (#142)

* Create method for getting weather based on zip code and country code

* Create unit test for new  method

* Add integration test for weather_at_zipcode

* Added my name into

* Remove uneeded 'pass' at end of function

* Bugfix

* #138 django models (#144)

* Using now tox also for integration tests running

* New ignored

* First model: Location

* More models

* Rename and replace with full Django project

* Station model

* StationHistory model

* UVIndex model

* Forgot some methods

* Fix typo

* Global import

* how to run tests

* Missing models and tests (still broken)

* Wrong classes

* Missing __repr__ methods

* Tests now working and fixed a few bugs

* Fix fields nullability

* save_all()

* Move all Django models stuff to a separate Github repository

* Remove ghost packages

* Don't package tests anymore

* also, no more test suites in

* Reverted

* Shorten README, linking to new Wiki pages

* Port back from master branch

* More contributors, more fun!

* Fix #149

* better name indeed

* Fix bug #152

* Deprecation decorator (#155)

* Deprecation decorator

* addendum

* #153 registry multiple matches (#157)

* Failing unit tests and implementation stub

* Rebase and add deprecations

* Nice, indeed

* Improve interface of ids_for and one more (failing) test

* Patch some city names as they were containing more than 1 comma

* Implementation and working tests for: ids_for()

* One more test

* Refactoring

* Implemented and tested: locations_for()

* Restore string versions and add deprecations (#161)

* Add tox coverage for Python3.6

* #162 better docs (#165)

* Better

* Move technical docs here from wiki

* Move contents to GitHub wiki

* Moved docs and included into as module

* Fix broken links and add usage examples for CityID Registry

* Prepare dump for 2.6.0

* not required

* we need these

* Helper for PyPi artifact submission

* Utility scripts

* #163 integration testing (#169)

* Add Python3.6

* Update

* Tell Travis-CI to use Python3.6 also and update integration dependencies versions

* Rename folder

* Broken build on Travis: reverting

* Fix unit tests that were broken with Python3.6

* Update deps but not tox

* Kidding :-S

* Fixed

* New BadGatewayError class and wired it into HTTP clients

* Improve

* Testing the code snippets in

* Now API Key is passed in as an environment variable

* Use DEFAULT_API_KEY in case env variable is empty

* A couple of new tests

* Fixes #167

* Fix #168

* Added deprecations in Sphinx docs

* Update

* Update to Ubuntu 16:04 and add Python3.6

* Fix for #173

* Dump version 2.6.1


A Python wrapper around the OpenWeatherMap API

PyPI version Build Status Coverage Status Downloads

What is it?

PyOWM is a client Python wrapper library for the OpenWeatherMap (OWM) web API.

It allows quick and easy consumption of OWM weather data from Python applications via a simple object model and in a human-friendly fashion.

PyOWM runs on Python 2.7 and Python 3.2+, and integrates with Django 1.10+ models.


Install with pip for your ease:

$ pip install pyowm

There is a lot of alternatives: setuptools, Windows installers and common package managers such as Yaourt


API key

As the OpenWeatherMap API needs a valid API key to allow responses, PyOWM won't work if you don't provide one. This stands for both the free and paid (pro) subscription plans.

You can signup for a free API key on the OWM website

Please notice that the free API subscription plan is subject to requests throttling.


import pyowm

owm = pyowm.OWM('your-API-key')  # You MUST provide a valid API key

# Have a pro subscription? Then use:
# owm = pyowm.OWM(API_key='your-API-key', subscription_type='pro')

# Will it be sunny tomorrow at this time in Milan (Italy) ?
forecast = owm.daily_forecast("Milan,it")
tomorrow = pyowm.timeutils.tomorrow()
forecast.will_be_sunny_at(tomorrow)  # Always True in Italy, right? ;-)

# Search for current weather in London (UK)
observation = owm.weather_at_place('London,uk')
w = observation.get_weather()
print(w)                      # <Weather - reference time=2013-12-18 09:20,
                              # status=Clouds>

# Weather details
w.get_wind()                  # {'speed': 4.6, 'deg': 330}
w.get_humidity()              # 87
w.get_temperature('celsius')  # {'temp_max': 10.5, 'temp': 9.7, 'temp_min': 9.0}

# Search current weather observations in the surroundings of
# lat=22.57W, lon=43.12S (Rio de Janeiro, BR)
observation_list = owm.weather_around_coords(-22.57, -43.12)

PyOWM usage examples are available here.


Each release has its own changelog.

The library API documentation is available on Read the Docs.


Contributors (coding, testing, packaging, reporting issues) are welcome!.

See the notes on development wiki page to get started.

See the notes on testing wiki page to get started


Join the PyOWM public Slack team by signing up here

Here are some cool projects that use PyOWM



MIT license