unofficial opensense.network api
Project description
OpenSense API
The Unofficial opensense.network API
osnapi documentation
official documentation
What is https://opensense.network/?
OpenSense is "A participatory open sensor data platform", making a uniform data format for a variety of open source weather data sources available to the public.
For more information, visit the website.
Install
To use this module in your project, you have multiple options. The easiest is to install it using the pip
packetmanager:
pip install osnapi
You can also clone this repo and create an editable install, in case you want to customize e.g. the error messages behaviour:
git clone <this repo>
cd <this repo>
pip install -e .
This module uses nbdev, a jupyter notebook based environment. If you go for the editable install, we recommend you to take a short look at nbdev first.
If you want a simple portable module, you can also just copy the osnapi folder into your project. No installation necessary.
How to use
Once you have installed this module using any of the methods above, you can use
import osnapi as api
and start coding.
If you want to use functions that require a login, use:
api.login(username, password)
The default api_enpoint is https://www.opensense.network/beta/api/v1.0/. This is stored inside the Settings
object.
The Settings
object looks like this:
class Settings():
api_endpoint = 'https://www.opensense.network/beta/api/v1.0/'
username = None
password = None
auth_token = None
To change the api_endpoint
, username
, password
, or auth_token
manually, simply assign to the Settings objects class variables e.g. api.Settings.username = 'Alice'
. Doing this is normally not necessary, because the values will automatically be filled out when using api.login()
.
It's important that you do not use an instance of Settings, but the class directly, because instanced changes will not be seen by the module.
To view your current settings, you can however instantiate a Settings object with api.Settings()
. Its string representation will display the current settings.
The authentication tokens you get from the server are JSON Web Tokens.
A Token is valid for one hour, but will automatically be reaquired using the credentials saved in Settings, once it runs out.
For an overview and documentation of the available functionality, check out the links at the top of this README
References
An example of a project using this api is: https://github.com/flpeters/serverless_opensense_dwd_importer
In that project we implement a data importer that downloads data from https://www.dwd.de/ and pushes that data to opensense.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file osnapi-0.0.1.tar.gz
.
File metadata
- Download URL: osnapi-0.0.1.tar.gz
- Upload date:
- Size: 15.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0.post20200309 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b0c35a3816e592851f0b4a88b5f11fef755b9c0aa4165c65a5a4f0d71efccc8a |
|
MD5 | 96c95f616457f3fce8762efbfc35cbba |
|
BLAKE2b-256 | b3d4805939e39123c9890bff307b1f206ae008455b292fff27f251c573b128ca |
File details
Details for the file osnapi-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: osnapi-0.0.1-py3-none-any.whl
- Upload date:
- Size: 13.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0.post20200309 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d52a12685a6a4322deda9ed2cecd65b10cf292784ddb00d067808f7e2d9854f |
|
MD5 | 12a1b859ea8a46a487382de1354a333e |
|
BLAKE2b-256 | 216faaaac0867d8788e0f26b978b94a8a9d0db14f5d9ff4f469d8130a6ae39b9 |