py-smn


Namepy-smn JSON
Version 0.1.0 PyPI version JSON
download
home_pagehttps://github.com/manucabral/py-smn
SummaryA Python wrapper for the SMN API Argentina
upload_time2023-01-17 19:02:49
maintainer
docs_urlNone
authorManuel Cabral
requires_python>=3.6
licenseMIT
keywords smn weather forecast api argentina smn-api
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # py-smn
A free and open source Python library for retrieving weather data from the National Meteorological Service of Argentina (SMN). 

## Note
This package offers two ways to obtain the requested data, the first is through the [API](https://ws.smn.gob.ar) of SMN and the second is by the public data offered by the official SMN [website](https://www.smn.gob.ar/descarga-de-datos). I recommend you use the second option since it is more accurate and is updated every day.


## Installation
From PyPI
```bash
pip install py-smn
```
From source code clone it
```bash
git clone https://github.com/manucabral/py-smn.git
cd py-smn
python -m pip install -r requirements.txt
```


## Usage
Using static (recommended method)
```py
import asyncio
import smn

async def main():
    async with smn.Client() as client:
        forecast_now = await client.get_static()
        province, lat, lon = await client.get_location()
        nearest_forecast = forecast_now.nearest(lat, lon)
        print(nearest_forecast.weather['temp'])

if __name__ == '__main__':
    asyncio.run(main())
```

Using API
```py
import asyncio
import smn

async def main():
    async with smn.Client() as client:
        forecast_now = await client.get(forecast='now')
        weather_stations = forecast_now.filter(province='Buenos Aires', name='La Plata')
        for weather_station in weather_stations:
            print(weather_station.name, weather_station.weather['temp'])

if __name__ == '__main__':
    asyncio.run(main())
```

## Constributions
All constributions, bug reports or fixes and ideas are welcome.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/manucabral/py-smn",
    "name": "py-smn",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "smn,weather,forecast,api,argentina,smn-api",
    "author": "Manuel Cabral",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/95/8c/4d01ab4d1c5a0f9a1e2452bc7b9a1422cbb614a1bcfe35804a2647e1ee6d/py-smn-0.1.0.tar.gz",
    "platform": null,
    "description": "# py-smn\r\nA free and open source Python library for retrieving weather data from the National Meteorological Service of Argentina (SMN). \r\n\r\n## Note\r\nThis package offers two ways to obtain the requested data, the first is through the [API](https://ws.smn.gob.ar) of SMN and the second is by the public data offered by the official SMN [website](https://www.smn.gob.ar/descarga-de-datos). I recommend you use the second option since it is more accurate and is updated every day.\r\n\r\n\r\n## Installation\r\nFrom PyPI\r\n```bash\r\npip install py-smn\r\n```\r\nFrom source code clone it\r\n```bash\r\ngit clone https://github.com/manucabral/py-smn.git\r\ncd py-smn\r\npython -m pip install -r requirements.txt\r\n```\r\n\r\n\r\n## Usage\r\nUsing static (recommended method)\r\n```py\r\nimport asyncio\r\nimport smn\r\n\r\nasync def main():\r\n    async with smn.Client() as client:\r\n        forecast_now = await client.get_static()\r\n        province, lat, lon = await client.get_location()\r\n        nearest_forecast = forecast_now.nearest(lat, lon)\r\n        print(nearest_forecast.weather['temp'])\r\n\r\nif __name__ == '__main__':\r\n    asyncio.run(main())\r\n```\r\n\r\nUsing API\r\n```py\r\nimport asyncio\r\nimport smn\r\n\r\nasync def main():\r\n    async with smn.Client() as client:\r\n        forecast_now = await client.get(forecast='now')\r\n        weather_stations = forecast_now.filter(province='Buenos Aires', name='La Plata')\r\n        for weather_station in weather_stations:\r\n            print(weather_station.name, weather_station.weather['temp'])\r\n\r\nif __name__ == '__main__':\r\n    asyncio.run(main())\r\n```\r\n\r\n## Constributions\r\nAll constributions, bug reports or fixes and ideas are welcome.\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A Python wrapper for the SMN API Argentina",
    "version": "0.1.0",
    "split_keywords": [
        "smn",
        "weather",
        "forecast",
        "api",
        "argentina",
        "smn-api"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "958c4d01ab4d1c5a0f9a1e2452bc7b9a1422cbb614a1bcfe35804a2647e1ee6d",
                "md5": "869850862b59bf8ba5e39d90e47795df",
                "sha256": "310a3d513d39dcde0edfbeb920d4fa7e458a1f073dd7003951d80653609b016e"
            },
            "downloads": -1,
            "filename": "py-smn-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "869850862b59bf8ba5e39d90e47795df",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 6669,
            "upload_time": "2023-01-17T19:02:49",
            "upload_time_iso_8601": "2023-01-17T19:02:49.377599Z",
            "url": "https://files.pythonhosted.org/packages/95/8c/4d01ab4d1c5a0f9a1e2452bc7b9a1422cbb614a1bcfe35804a2647e1ee6d/py-smn-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-17 19:02:49",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "manucabral",
    "github_project": "py-smn",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "py-smn"
}
        
Elapsed time: 0.07514s