Skip to main content

Contributors Forks Stargazers Issues LinkedIn


py-open-weather

A python3 library providing information of Current & Forecast of Weather as well as Air Pollution based on data from OpenWeatherMap.
Explore the docs »

View Demo · Report Bug

Table of Contents
  1. About The Library
  2. Getting Started
  3. Usage
  4. License
  5. Contact

About The Library

A python3 library providing information of Current & Forecast of Weather as well as Air Pollution based on data from OpenWeatherMap.

Built With

Getting Started

Prerequisites

Python3 and Above

Installation

  1. Install the Library :eyes:
    pip install py-open-weather
    

demo1

  1. And you are done :boom:

Usage

  • get Api key from OpenWeatherMap and pass it as environment variable
# for Windows (PowerShell)
>>> $Env:API_KEY='YOUR API KEY'

# for Linux
>>> export API_KEY='YOUR API KEY'
  • (Current) Air pollution Data based on longitude and latitude
>>> from pyweather import airpol
>>> airpol.by_geoc(50,50)
AirpolData(coord={'lon': 50.0, 'lat': 50.0}, list=[ListItem(dt=1609837200, main=Main(aqi=1), components=Components(co=257.02, no=0.27, no2=0.68, o3=55.08, so2=0.54, pm2_5=4.8, pm10=4.86, nh3=0.1))])
>>> airpol.by_geoc(50,50,'forecast')

demo2

  • (Forecast) Air pollution Data based on longitude and latitude
>>> from pyweather import airpol
>>> airpol.by_geoc(50,50,'forecast')
  • Current Weather Data based on cityname
>>> from pyweather import curweath
>>> curweath.by_cname('delhi')
WeatherData(coord=Coord(lon=77.22, lat=28.67), weather=[WeatherItem(id=701, main='Mist', description='mist', icon='50d')], base='stations', main=Main(temp=292.15, feels_like=293.41, temp_min=292.15, temp_max=292.15, pressure=1016, humidity=93, sea_level=None, grnd_level=None), visibility=1200, wind=Wind(speed=2.1, deg=30, gust=None), clouds=Clouds(all=75), dt=1609836404, sys=Sys(type=1, id=9165, message=None, country='IN', sunrise=1609811084, sunset=1609848469), timezone=19800, id=1273294, name='Delhi', cod=200)
>>> curweath.by_cid(2172797)

demo3

  • Current Weather Data based on city id
>>> from pyweather import curweath
>>> curweath.by_cid(2172797)
WeatherData(coord=Coord(lon=145.77, lat=-16.92), weather=[WeatherItem(id=521, main='Rain', description='shower rain', icon='09d'), WeatherItem(id=211, main='Thunderstorm', description='thunderstorm', icon='11d')], base='stations', main=Main(temp=299.2, feels_like=305.28, temp_min=299.15, temp_max=299.26, pressure=1003, humidity=94, sea_level=None, grnd_level=None), visibility=6000, wind=Wind(speed=0.5, deg=270, gust=None), clouds=Clouds(all=75), dt=1609836846, sys=Sys(type=1, id=9490, message=None, country='AU', sunrise=1609789743, sunset=1609836896), timezone=36000, id=2172797, name='Cairns', cod=200)

demo4

  • Current Weather Data based on zipcode and country code
>>> from pyweather import curweath
>>> curweath.by_zcode(110032, 'in')
WeatherData(coord=Coord(lon=77.29, lat=28.69), weather=[WeatherItem(id=701, main='Mist', description='mist', icon='50d')], base='stations', main=Main(temp=292.15, feels_like=293.41, temp_min=292.15, temp_max=292.15, pressure=1016, humidity=93, sea_level=None, grnd_level=None), visibility=1200, wind=Wind(speed=2.1, deg=30, gust=None), clouds=Clouds(all=75), dt=1609836721, sys=Sys(type=1, id=9165, message=None, country='IN', sunrise=1609811070, sunset=1609848450), timezone=19800, id=0, name='Babarpur (North East Delhi)', cod=200)

demo5

  • Current Weather Data based on Longitude and Latitude
>>> from pyweather import curweath
>>> curweath.by_geoc(50,50)
WeatherData(coord=Coord(lon=50.0, lat=50.0), weather=[WeatherItem(id=804, main='Clouds', description='overcast clouds', icon='04d')], base='stations', main=Main(temp=262.97, feels_like=256.76, temp_min=262.97, temp_max=262.97, pressure=1042, humidity=93, sea_level=1042, grnd_level=1041), visibility=10000, wind=Wind(speed=4.4, deg=132, gust=None), clouds=Clouds(all=99), dt=1609836784, sys=Sys(type=None, id=None, message=None, country='KZ', sunrise=1609821467, sunset=1609851156), timezone=18000, id=607847, name='West Kazakhstan', cod=200)

demo6

License

Distributed under the MIT License. See LICENSE for more information.

Contact

CodewithRv - ravigoel.1997@gmail.com

Project Link: https://github.com/ravigoel08/py-open-weather

Metadata

Release files for py-open-weather 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py-open-weather 0.1.3
File Size Uploaded Provenance
py-open-weather-0.1.3.tar.gz 23.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for py-open-weather 0.1.3
File Interpreter ABI Platform
py_open_weather-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 32.4 kB

Release files / py-open-weather-0.1.3.tar.gz

Download URL py-open-weather-0.1.3.tar.gz
Size 23.7 kB
Tags Source
SHA-256 checksum
How to use checksums
60a251eb6d7501d5c53eeb6d216fc7508d367dba539d11a43327741078c8ca06
BLAKE2b-256 checksum
How to use checksums
e3c03bcdd9a83c08865023bddf6cf3ebc598f7fc226411abd233996ec26e33d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.9.1

Release files / py_open_weather-0.1.3-py3-none-any.whl

Download URL py_open_weather-0.1.3-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3e896832706fc2eed3425d77719fc16320998481ee89c6d3c1183f1390abb245
BLAKE2b-256 checksum
How to use checksums
b17efbd05c740218e4fa1b04c0b6041f46242000f55c9c13082e742b149a606f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.9.1

Security for py-open-weather 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page