Simple python wrapper around Open Weather PWS API
Requirements
You need API key to use it. You can get it for free: https://home.openweathermap.org/api_keys
Usage
Import Station class, which contains all api methods:
from openweather_pws import Station
Station
Register new station:
pws = Station(api_key='YOUR_API_KEY')
station_id = pws.register(external_id='YOUR_STATION_EXTERNAL_ID',
name='YOUR STATION LONG NAME',
latitude='44.419181',
longitude='38.205109',
altitude='70') # altitude in meters
# If you plan to use pws class further, please note that
# station_id will be stored as default station_id of class.
# Note: always use different external_id for each station!
Get info about the station:
pws = Station(api_key=api_key)
pws.info(station_id='YOUR_STATION_ID')
Or, when station_id is set:
pws = Station(api_key=api_key, station_id='YOUR_STATION_ID')
# if you iniatilize Station class with station_id param,
# it will be used as default in all API call, if another is not specified
You can set/change station_id any time you want:
pws.set_station_id(station_id)
Update station info:
pws.update(station_id, external_id, name, latitude, longitude, altitude)
Delete station:
pws.delete(station_id)
Get all stations info
pws.all_stations() # will return all stations registered by user in list
Measurements
Measurements can be accessed via Station class:
pws.measurements.%method%
or directly, if needed:
from openweather_pws import Measurements
meas = Measurements(api_key='YOUR_API_KEY', station_id='YOUR_STATION_ID') # station_is optional
Also, you can set/change station_id any time you want:
meas.set_station_id(station_id)
To obtain list of measurements from station:
measurements = pws.meas.get(station_id, meas_type, limit, time_from, time_to)
# all params are optional
# by default will be used default station_id, hourly data (24 measurements)
# refer to: https://openweathermap.org/stations#get_measurements
Get only one measurement:
measurement = pws.meas.get_one(station_id, meas_type, time_from, time_to)
# all params are optional
# by default will be used default station_id and hourly data, 1 measurement
Send data of one measurement to PWS:
pws.meas.set(dt, station_id, temperature, wind_speed, wind_gust, wind_deg,
pressure, humidity, rain_1h, rain_6h, rain_24h, snow_1h, snow_6h,
snow_24h, dew_point, humidex, heat_index, visibility_distance,
visibility_prefix, clouds, weather)
# all params are optional
# by default will be used default station_id, dt is current time in unixtime format
# refer to: https://openweathermap.org/stations#measurement
Send bulk data of PWS you'll need to prepare list with dicts and send it via:
pws.meas.set_bulk(payload)
Terms of service
Refer to https://openweathermap.org/
Metadata
Release files for openweather-pws 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| openweather-pws-1.0.2.tar.gz | 3.9 kB | Without provenance | Details for openweather-pws-1.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| openweather_pws-1.0.2-py3-none-any.whl | Python 3 | none | any | Details for openweather_pws-1.0.2-py3-none-any.whl |
Total release size: 8.2 kB
Release files / openweather-pws-1.0.2.tar.gz
| Download URL | openweather-pws-1.0.2.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d32c4eeda38fd37603e3f38e70a74363864f585064472676d8c1eeb8c12a7836
|
|
BLAKE2b-256 checksum How to use checksums |
e548454873ca629ff9dd6ebacbd370311a7973de05f7f95e5734ed6e44e8da03
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.21.0 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.0
|
Release files / openweather_pws-1.0.2-py3-none-any.whl
| Download URL | openweather_pws-1.0.2-py3-none-any.whl |
|---|---|
| Size | 4.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1363009fdaf4b25ebca1304bf98ef127b22483ea44ab2ebe449ae00cb76c2e51
|
|
BLAKE2b-256 checksum How to use checksums |
388a3970bd069ac204e711e1d25e24310e4ce263a13e39178836ed9776e01293
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.21.0 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.0
|
Security for openweather-pws 1.0.2
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.