Python Other
Latest commit 9ee1f88 Dec 23, 2017 @csparpa csparpa Release 2.8.0 (#230)
* Small fix preventing docker from building correctly

* 202 discard outdated forecast (#205)

* Small fix preventing docker from building correctly

* Fixes #202

* 199 fix coveralls (#206)

* testing travis-ci build after this mod...

* another test

* now showing coverage on the master branch instead of the develop one

* now it should be OK

* 210 unicode error (#213)

* Fix integration test

* Possible fix, needs testing

* Making Travis-CI work

* Fixes #216

* Fixes #219

* Alpine docker and switch to tox-travis (#222)

* Dockerfiles and build utils for Alpine containers

* Refactored examples/getTemp.py

* More refactoring due to codeclimate warnings

* switch to tox-travis

* add Simone-Zabberoni to contributors

* update of Linux distro for Travis CI builds

* rename

* moved to online Wiki

* Renamed dockerfiles for Alpine images

* improved build script

* Renamed dockerfile for ubuntu

* UK is wrong - GB is right

* Dockerfiles into one single folder; adapted Docker build and publish scripts; moved test script

* fix

* Fix for #224

* 137 Stations API support (#225)

* Introducing requests as new convenience HTTP client

* New deprecation to be executed upon future version 3.0.0

* Updated with some fixes

* New germinal HTTP Client class

* Cleaned

* Refactoring

* More refactoring, and introducing StationsManagaer class

* forgot

* Station entity, parser and tests; adding more stations_manager methods

* fixing broken build on travis-ci

* Refactoring to allow class deprecations

* More tests and namespace

* time properties in different formats

* Refactoring and more tests

* Seems like IDs are returned with capitalized letters in JSON - and also altitudes can be optional

* Proper testing and stations_manager.create_station

* Trying to fix broken Travis-CI build

* Implemented update of stations (PUT)

* IMplemented deletion of stations (DELETE)

* Fix bug on microseconds parsing

* Integration test

* Fix imports

* Fix documentation

* Forgot

* Fix docs

* AggregatedMeasurement and Measurement classes and their unit tests

* Buffer class and tests

* PersistenceBackends and tests

* CI build is broken, trying to use an old Linux image for builds

* method skeletons

* One more method

* Parser for AggregatedMeasurement objects from JSON

* Stations Manager methods related to measurements and buffer handling

* Committing old work (might break tests)

* refactored stations api version out

* docs

* fix issue with timestamps not having microseconds

* this way empty payloads are handled OK

* No prints, baby

* Now working

* Defaulted to 100 the number of measurements that can be retrieved by the Stations API; fixed data blob sent when posting measurements

* otherwise TRavis-CI builds won't start

* Add few methods to query for "clear" conditions; deprecated on v3.0 the ones querying for "sun" conditions (#227)

* remove diff fragments

* Fix error

* Updated city ID database files

* removed usage of deprecated method

* fix broken test

* bump to version 2.8.0

* documentation and usage examples

README.md

PyOWM ☀️ ☔️ 🐍

A Python wrapper around the OpenWeatherMap API

PyPI version Build Status Coverage Status Say Thanks!

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.

Installation

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

Eager to fetch the very latest updates to PyOWM? Install the development trunk:

$ pip install git+https://github.com/csparpa/pyowm.git@develop

Usage

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.

Examples

That's what you can do with PyOWM and a free OWM API Key:

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')

# Search for current weather in London (Great Britain)
observation = owm.weather_at_place('London,GB')
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)

And this is a usage example with a paid OWM API key:

import pyowm

paid_owm = pyowm.OWM(API_key='your-pro-API-key', subscription_type='pro')

# Will it be clear tomorrow at this time in Milan (Italy) ?
forecast = paid_owm.daily_forecast("Milan,IT")
tomorrow = pyowm.timeutils.tomorrow()
forecast.will_be_clear_at(tomorrow)  # The sun always shines on Italy, right? ;-)

More PyOWM usage examples are available here.

Documentation

Each release has its own changelog.

The library API documentation is available on Read the Docs.

Contributing

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

See the CONTRIBUTING.md file to get started.

See the notes on testing wiki page to get started

Community

Join the PyOWM public Slack team by signing up here

Here are some cool projects that use PyOWM

References

License

MIT license