Skip to main content

A Python wrapper for the SMN API Argentina

Project description

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 of SMN and the second is by the public data offered by the official SMN website. I recommend you use the second option since it is more accurate and is updated every day.

Installation

From PyPI

pip install py-smn

From source code clone it

git clone https://github.com/manucabral/py-smn.git
cd py-smn
python -m pip install -r requirements.txt

Usage

Using static (recommended method)

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

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py-smn-0.1.0.tar.gz (6.7 kB view details)

Uploaded Source

File details

Details for the file py-smn-0.1.0.tar.gz.

File metadata

  • Download URL: py-smn-0.1.0.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for py-smn-0.1.0.tar.gz
Algorithm Hash digest
SHA256 310a3d513d39dcde0edfbeb920d4fa7e458a1f073dd7003951d80653609b016e
MD5 869850862b59bf8ba5e39d90e47795df
BLAKE2b-256 958c4d01ab4d1c5a0f9a1e2452bc7b9a1422cbb614a1bcfe35804a2647e1ee6d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page