Package: pyowm
PyOWMA Python wrapper around OpenWeatherMap web APIsWhat is it?PyOWM is a client Python wrapper library for OpenWeatherMap (OWM) web APIs. It allows quick and easy consumption of OWM data from Python applications via a simple object model and in a human-friendly fashion.PyOWM runs on Python 3.7+Former Dark Sky API users: you can can use PyOWM to getOpenWeatherMap's OneCall APIdata as an easy replacement to Dark SkyWhat kind of data can I get with PyOWM ?With PyOWM you can integrate into your code any of the following OpenWeatherMap web APIs:Weather API v2.5+OneCall API, providing current weather data, weather forecasts, weather historyAgro API v1.0, providing soil data and satellite imagery search and downloadAir Pollution API v3.0, providing data about CO, O3, NO2 and SO2UV Index API v3.0, providing data about Ultraviolet expositionStations API v3.0, allowing to create and manage meteostation and publish local weather measurementsWeather Alerts API v3.0, allowing to set triggers on weather conditions and areas and poll for spawned alertsImage tilesfor several map layers provided by OWMGeocoding API v1.0allowing to perform direct/reverse geocodingIn case of trouble...Pleaseread theFAQbefore filing a new issue on GitHub! There are many common issues, therefore a fix for your issue might come easier than you thinkGet startedAPI keyAs OpenWeatherMap APIs need a valid API key to allow responses,PyOWM won't work if you don't provide one. This stands for both free and paid (pro) subscription plans.
You can signup for a free API keyon the OWM websitePlease notice that the free API subscription plan is subject to requests throttling.ExampleWith a free OWM API Key:frompyowmimportOWMfrompyowm.utilsimportconfigfrompyowm.utilsimporttimestamps# ---------- FREE API KEY examples ---------------------owm=OWM('your free OWM API key')mgr=owm.weather_manager()# Search for current weather in London (Great Britain) and get detailsobservation=mgr.weather_at_place('London,GB')w=observation.weatherw.detailed_status# 'clouds'w.wind()# {'speed': 4.6, 'deg': 330}w.humidity# 87w.temperature('celsius')# {'temp_max': 10.5, 'temp': 9.7, 'temp_min': 9.0}w.rain# {}w.heat_index# Nonew.clouds# 75# Will it be clear tomorrow at this time in Milan (Italy) ?forecast=mgr.forecast_at_place('Milan,IT','daily')answer=forecast.will_be_clear_at(timestamps.tomorrow())# ---------- PAID API KEY example ---------------------config_dict=config.get_default_config_for_subscription_type('professional')owm=OWM('your paid OWM API key',config_dict)# What's the current humidity in Berlin (Germany) ?one_call_object=mgr.one_call(lat=52.5244,lon=13.4105)one_call_object.current.humidityInstallationInstall withpipfor your ease:$pipinstallpyowmThere are alternatives:setuptools,Windows installersand common Linux package managers such asYaourt (Arch Linux)YaST/Zypper (OpenSuse)(please refer to the documentation for more detail)Eager to fetch the very latest updates to PyOWM? Install the development trunk (which might be unstable). Eg on Linux:$gitclonehttps://github.com/csparpa/pyowm.git
$cdpyowm&&gitcheckoutdevelop
$pipinstall-rrequirements.txt&&pythonsetup.pyinstallDocumentationThe library software API documentation is available onRead the Docs.TheCode recipessection comes in handy!Community & ContributingHere aresome cool projectsthat use PyOWMJoin thePyOWM public Slack teamby signing uphereContributors (coding, testing, packaging, reporting issues) are welcome!See thethe official documentation websitefor details or theCONTRIBUTING.mdfile for a quick primer.LicenseMIT license