Skip to main content

Client library for Regobs

Project description

regobslib — A Regobs client library

This client library aim to simplify interaction with the Regobs API v5.

Currently we only support registration submission via this client library.

Prerequisites

Example programs

Below is a simple program demonstrating how to register a whumpf sound at a given location and time.

from regobslib import *
import datetime as dt
import pprint

# Contact awa@nve.no to get an API token.
TOKEN = "00000000-0000-0000-0000-000000000000"

# Contact awa@nve.no to get a client ID.
CLIENT_ID = "00000000-0000-0000-0000-000000000000"

# Create a user at https://test-konto.nve.no/ or https://konto.nve.no/
USERNAME = "john.smith@example.com"
PASSWORD = "P4ssw0rd"

# First we create an empty SnowRegistration object
reg = SnowRegistration(REGOBS_TZ.localize(dt.datetime(2021, 8, 17, 9, 48)),
                       Position(lat=68.4293, lon=18.2572))

# Then we add a DangerSign observation to it
reg.add_danger_sign(DangerSign(DangerSign.Sign.WHUMPF_SOUND))

# Authenticate to Regobs to be able to submit observations
connection = Connection().authenticate(USERNAME, PASSWORD, CLIENT_ID, TOKEN, prod=False)

# Send our SnowRegistration to Regobs
stored_reg = connection.submit(reg, Connection.Language.ENGLISH)
pprint.pprint(stored_reg)

For a more extensive demonstration, refer to demo.py.

Documentation

We have yet to write documentation, but the function declarations are written with type hints and most parameters are enums, so the code in submit.py may help you on your way. A properly set up IDE will also use the type hints and enums to inform you about your alternatives.

You can also use GitHubs built-in code navigation to quickly find the definition of a class or method in the example code:

GitHub code navigation

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

regobslib-0.0.2.tar.gz (12.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

regobslib-0.0.2-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file regobslib-0.0.2.tar.gz.

File metadata

  • Download URL: regobslib-0.0.2.tar.gz
  • Upload date:
  • Size: 12.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.8.10

File hashes

Hashes for regobslib-0.0.2.tar.gz
Algorithm Hash digest
SHA256 2cece6a354537c179983c3b875b1c2b04f898136394b1b6b675b4f8507842c1d
MD5 6b8a5405ac660969c179fc7f0943b1b9
BLAKE2b-256 1ae5e443e3373a3e9140ae5a628d13e5f922ed5ab5cadc5bf8e784744c9a649c

See more details on using hashes here.

File details

Details for the file regobslib-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: regobslib-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.8.10

File hashes

Hashes for regobslib-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 561551e4997fd75dde911c2c97bfd14d0f24a054b646bdd5b4baf0431ed19da9
MD5 8da6b701f3db421b1b58da242cfb2473
BLAKE2b-256 940a0d7ecf2cfe005b2342a82dfa813d4a0c12c093aac035902417c7267a8aae

See more details on using hashes here.

Supported by

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