https://github.com/jeeftor/weatherflow-openapi-python
Python client generated form OpenAPI Spec
https://github.com/jeeftor/weatherflow-openapi-python
Last synced: about 1 year ago
JSON representation
Python client generated form OpenAPI Spec
- Host: GitHub
- URL: https://github.com/jeeftor/weatherflow-openapi-python
- Owner: jeeftor
- Created: 2023-12-27T22:14:26.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-12-27T22:16:32.000Z (over 2 years ago)
- Last Synced: 2025-02-13T00:22:31.726Z (over 1 year ago)
- Language: Python
- Size: 59.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# weatherflow-openapi
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
- API version: 1.0.0
- Package version: 1.0.0
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
## Requirements.
Python 3.7+
## Installation & Usage
### pip install
If the python package is hosted on a repository, you can install directly using:
```sh
pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git
```
(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git`)
Then import the package:
```python
import weatherflow_openapi
```
### Setuptools
Install via [Setuptools](http://pypi.python.org/pypi/setuptools).
```sh
python setup.py install --user
```
(or `sudo python setup.py install` to install the package for all users)
Then import the package:
```python
import weatherflow_openapi
```
### Tests
Execute `pytest` to run the tests.
## Getting Started
Please follow the [installation procedure](#installation--usage) and then run the following:
```python
import time
import weatherflow_openapi
from weatherflow_openapi.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to http://swd.weatherflow.com/swd/rest
# See configuration.py for a list of all supported configuration parameters.
configuration = weatherflow_openapi.Configuration(
host = "http://swd.weatherflow.com/swd/rest"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure API key authorization: swdApiKey
configuration.api_key['swdApiKey'] = os.environ["API_KEY"]
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['swdApiKey'] = 'Bearer'
configuration.access_token = os.environ["ACCESS_TOKEN"]
# Enter a context with an instance of the API client
async with weatherflow_openapi.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = weatherflow_openapi.ForecastApi(api_client)
station_id = 56 # int | The station_id to use in the current conditions response object.
units_temp = 'units_temp_example' # str | default = c (optional)
units_wind = 'units_wind_example' # str | default = mps (optional)
units_pressure = 'units_pressure_example' # str | default = mb (optional)
units_precip = 'units_precip_example' # str | default = mm (optional)
units_distance = 'units_distance_example' # str | default = km (optional)
try:
# Get Better Forecast Data
api_response = await api_instance.get_better_forecast(station_id, units_temp=units_temp, units_wind=units_wind, units_pressure=units_pressure, units_precip=units_precip, units_distance=units_distance)
print("The response of ForecastApi->get_better_forecast:\n")
pprint(api_response)
except ApiException as e:
print("Exception when calling ForecastApi->get_better_forecast: %s\n" % e)
```
## Documentation for API Endpoints
All URIs are relative to *http://swd.weatherflow.com/swd/rest*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*ForecastApi* | [**get_better_forecast**](docs/ForecastApi.md#get_better_forecast) | **GET** /better_forecast | Get Better Forecast Data
*ObservationsApi* | [**get_observations_by_device_id**](docs/ObservationsApi.md#get_observations_by_device_id) | **GET** /observations/device/{device_id} | Get Observations for a Single Device
*ObservationsApi* | [**get_station_observation**](docs/ObservationsApi.md#get_station_observation) | **GET** /observations/station/{station_id} | Get the latest Station observation
*StationsApi* | [**get_station_by_id**](docs/StationsApi.md#get_station_by_id) | **GET** /stations/{station_id} | Find a Station by station_id
*StationsApi* | [**get_stations**](docs/StationsApi.md#get_stations) | **GET** /stations | Find all Stations for a user
## Documentation For Models
- [BetterForecast](docs/BetterForecast.md)
- [BetterForecastCurrentConditions](docs/BetterForecastCurrentConditions.md)
- [BetterForecastDailyForecast](docs/BetterForecastDailyForecast.md)
- [BetterForecastForecast](docs/BetterForecastForecast.md)
- [BetterForecastHourlyForecast](docs/BetterForecastHourlyForecast.md)
- [BetterForecastUnits](docs/BetterForecastUnits.md)
- [Device](docs/Device.md)
- [DeviceMeta](docs/DeviceMeta.md)
- [ObservationSet](docs/ObservationSet.md)
- [Station](docs/Station.md)
- [StationItem](docs/StationItem.md)
- [StationMeta](docs/StationMeta.md)
- [StationObservation](docs/StationObservation.md)
- [StationObservationValues](docs/StationObservationValues.md)
- [StationSet](docs/StationSet.md)
- [StationUnits](docs/StationUnits.md)
- [Status](docs/Status.md)
## Documentation For Authorization
Authentication schemes defined for the API:
### swdImplicit
- **Type**: OAuth
- **Flow**: implicit
- **Authorization URL**: https://smartweather.weatherflow.com/authorize.html
- **Scopes**:
- **user**: Grants read/write access to all user data.
- **Type**: API key
- **API key parameter name**: token
- **Location**: URL query string
## Author
jforare@weatherflow.com