# [python-weather][pypi-url] [![pypi][pypi-image]][pypi-url] [![downloads][downloads-image]][pypi-url] [![codacy-badge][codacy-url]][codacy-image] [![ko-fi][ko-fi-brief-image]][ko-fi-url]
[pypi-image]: https://img.shields.io/pypi/v/python-weather.svg?style=flat-square
[pypi-url]: https://pypi.org/project/python-weather/
[downloads-image]: https://img.shields.io/pypi/dm/python-weather?style=flat-square
[ko-fi-brief-image]: https://img.shields.io/badge/donations-ko--fi-red?color=ff5e5b&style=flat-square
[codacy-url]: https://app.codacy.com/project/badge/Grade/0f7721b7e4314a748c75a04f0a7e0ce3
[codacy-image]: https://app.codacy.com/gh/null8626/python-weather/dashboard
[ko-fi-image]: https://ko-fi.com/img/githubbutton_sm.svg
[ko-fi-url]: https://ko-fi.com/null8626
A free and asynchronous weather Python API wrapper made in Python, for Python.
## Installation
```console
pip install python-weather
```
## Example
For more information, please read the [documentation](https://python-weather.readthedocs.io/en/latest/).
```py
# import the module
import python_weather
import asyncio
import os
async def getweather() -> None:
# declare the client. the measuring unit used defaults to the metric system (celcius, km/h, etc.)
async with python_weather.Client(unit=python_weather.IMPERIAL) as client:
# fetch a weather forecast from a city
weather = await client.get('New York')
# returns the current day's forecast temperature (int)
print(weather.temperature)
# get the weather forecast for a few days
for daily in weather:
print(daily)
# hourly forecasts
for hourly in daily:
print(f' --> {hourly!r}')
if __name__ == '__main__':
# see https://stackoverflow.com/questions/45600579/asyncio-event-loop-is-closed-when-getting-loop
# for more details
if os.name == 'nt':
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
asyncio.run(getweather())
```
## Data source
This library depends on [`wttr.in`](https://github.com/chubin/wttr.in), which uses data from the [World Weather Online API](https://www.worldweatheronline.com/weather-api/).
## Donations
If you want to support this project, consider donating! ❤
[![ko-fi][ko-fi-image]][ko-fi-url]
Raw data
{
"_id": null,
"home_page": null,
"name": "python-weather",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "weather, forecast, weather-api, weather-forecast",
"author": "null8626",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/6c/a4/e34ad7a71de7d9cbdb8d972513ed37ca71213b11c259eed2e4c097d0a7fb/python_weather-2.0.7.tar.gz",
"platform": null,
"description": "# [python-weather][pypi-url] [![pypi][pypi-image]][pypi-url] [![downloads][downloads-image]][pypi-url] [![codacy-badge][codacy-url]][codacy-image] [![ko-fi][ko-fi-brief-image]][ko-fi-url]\r\n\r\n[pypi-image]: https://img.shields.io/pypi/v/python-weather.svg?style=flat-square\r\n[pypi-url]: https://pypi.org/project/python-weather/\r\n[downloads-image]: https://img.shields.io/pypi/dm/python-weather?style=flat-square\r\n[ko-fi-brief-image]: https://img.shields.io/badge/donations-ko--fi-red?color=ff5e5b&style=flat-square\r\n[codacy-url]: https://app.codacy.com/project/badge/Grade/0f7721b7e4314a748c75a04f0a7e0ce3\r\n[codacy-image]: https://app.codacy.com/gh/null8626/python-weather/dashboard\r\n[ko-fi-image]: https://ko-fi.com/img/githubbutton_sm.svg\r\n[ko-fi-url]: https://ko-fi.com/null8626\r\n\r\nA free and asynchronous weather Python API wrapper made in Python, for Python.\r\n\r\n## Installation\r\n\r\n```console\r\npip install python-weather\r\n```\r\n\r\n## Example\r\n\r\nFor more information, please read the [documentation](https://python-weather.readthedocs.io/en/latest/).\r\n\r\n```py\r\n# import the module\r\nimport python_weather\r\n\r\nimport asyncio\r\nimport os\r\n\r\nasync def getweather() -> None:\r\n # declare the client. the measuring unit used defaults to the metric system (celcius, km/h, etc.)\r\n async with python_weather.Client(unit=python_weather.IMPERIAL) as client:\r\n # fetch a weather forecast from a city\r\n weather = await client.get('New York')\r\n \r\n # returns the current day's forecast temperature (int)\r\n print(weather.temperature)\r\n \r\n # get the weather forecast for a few days\r\n for daily in weather:\r\n print(daily)\r\n \r\n # hourly forecasts\r\n for hourly in daily:\r\n print(f' --> {hourly!r}')\r\n\r\nif __name__ == '__main__':\r\n # see https://stackoverflow.com/questions/45600579/asyncio-event-loop-is-closed-when-getting-loop\r\n # for more details\r\n if os.name == 'nt':\r\n asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())\r\n \r\n asyncio.run(getweather())\r\n```\r\n\r\n## Data source\r\n\r\nThis library depends on [`wttr.in`](https://github.com/chubin/wttr.in), which uses data from the [World Weather Online API](https://www.worldweatheronline.com/weather-api/).\r\n\r\n## Donations\r\n\r\nIf you want to support this project, consider donating! \u2764\r\n\r\n[![ko-fi][ko-fi-image]][ko-fi-url]\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A free and asynchronous weather API wrapper made in Python, for Python.",
"version": "2.0.7",
"project_urls": {
"Changelog": "https://python-weather.readthedocs.io/en/latest/changelog.html",
"Documentation": "https://python-weather.readthedocs.io/en/latest/",
"Donate via GitHub Sponsors": "https://github.com/sponsors/null8626",
"Donate via Ko-fi": "https://ko-fi.com/null8626",
"Repository": "https://github.com/null8626/python-weather"
},
"split_keywords": [
"weather",
" forecast",
" weather-api",
" weather-forecast"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "92477707e8314e48bc52e6a3b471332416caf3ef387587a716e935ff064a722c",
"md5": "db067dfb056cc06351b1b0bc1d5d78de",
"sha256": "7ed43d42ab0b023955b90bd1011e5232ebe41eb35422cf9e82756ff2fbee0d3d"
},
"downloads": -1,
"filename": "python_weather-2.0.7-py3-none-any.whl",
"has_sig": false,
"md5_digest": "db067dfb056cc06351b1b0bc1d5d78de",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 17484,
"upload_time": "2024-10-14T10:16:31",
"upload_time_iso_8601": "2024-10-14T10:16:31.199730Z",
"url": "https://files.pythonhosted.org/packages/92/47/7707e8314e48bc52e6a3b471332416caf3ef387587a716e935ff064a722c/python_weather-2.0.7-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6ca4e34ad7a71de7d9cbdb8d972513ed37ca71213b11c259eed2e4c097d0a7fb",
"md5": "37dfb782c39d889888e85d4ddac5cf8d",
"sha256": "342ef332fc092ffe14904dd97fc5e4b544b6dd8954108d05e3d67863a90fa349"
},
"downloads": -1,
"filename": "python_weather-2.0.7.tar.gz",
"has_sig": false,
"md5_digest": "37dfb782c39d889888e85d4ddac5cf8d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 12975,
"upload_time": "2024-10-14T10:16:32",
"upload_time_iso_8601": "2024-10-14T10:16:32.713656Z",
"url": "https://files.pythonhosted.org/packages/6c/a4/e34ad7a71de7d9cbdb8d972513ed37ca71213b11c259eed2e4c097d0a7fb/python_weather-2.0.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-14 10:16:32",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "sponsors",
"github_project": "null8626",
"github_not_found": true,
"lcname": "python-weather"
}