Skip to main content

regobslib — A Regobs client library

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

Prerequisites

Installation

To install using pip:

pip install regobslib

Example programs

Searching for data

Here is an example program searching for weather observations in Ofoten.

from regobslib import *

connection = Connection(prod=True)
results = connection.search(SnowRegistration, regions=[SnowRegion.OFOTEN], observation_types=[Weather])

print(f"Length of results: {len(results)}\n")

print("First result")
print(results[0])

print("\nIterates over results")
for result in results:
    print(f"Id: {result.id}, Observer: {result.observer.nickname}, Date: {result.obs_time}")

Submitting data

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

# Contact regobs@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 = "ola.nordmann@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(prod=False).authenticate(USERNAME, PASSWORD, CLIENT_ID)

# Send our SnowRegistration to Regobs
stored_reg = connection.submit(reg)
print(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.

Developer notes

The package is built according to the instructions in the Python Packaging User Guide.

For serialization/deserialisation, most of the Regobs work is done in src/regobslib/submit.py. The project rely heavily on enums. These are available in src/regobslib/types.py. Any outside connections (Regobs, Varsom, APS) is handled in src/regobslib/connection.py.

Metadata

Release files for regobslib 1.0.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for regobslib 1.0.11
File Size Uploaded Provenance
regobslib-1.0.11.tar.gz 34.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for regobslib 1.0.11
File Interpreter ABI Platform
regobslib-1.0.11-py3-none-any.whl Python 3 none any Details

Total release size: 70.1 kB

Release files / regobslib-1.0.11.tar.gz

Download URL regobslib-1.0.11.tar.gz
Size 34.8 kB
Tags Source
SHA-256 checksum
How to use checksums
034f58fc72be95d0ecf39f9746fe1b64569465d18d4250eb9610d7ef142296b5
BLAKE2b-256 checksum
How to use checksums
76577ff8dc8a9c7726885af2445591e494a4bdf3ee368db9eb6165f77bca8436
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Release files / regobslib-1.0.11-py3-none-any.whl

Download URL regobslib-1.0.11-py3-none-any.whl
Size 35.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ce926b721971f006821c10d9c78075fbc57e5206f998be606b29172813ad3aea
BLAKE2b-256 checksum
How to use checksums
5d8ee69edc22d9cbc3686c606d74d2b0c7ba7f2ce0aba733ab3fcb4d2fd69cd0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Security for regobslib 1.0.11

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.

Release history Release notifications | RSS feed

This release

1.0.11 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page