Skip to main content

Harmonized Python script for DestinE authentication.

Project description

destinepyauth

A Python library for authenticating against DESP (Destination Earth Service Platform) services.

Installation

pip install destinepyauth

For development:

pip install -e ".[dev]"

Usage

The main entry point is the get_token() function:

from destinepyauth import get_token

# Authenticate (prompts for credentials if not in environment)
result = get_token("highway")

# Access the token
token = result.access_token

Using with requests

from destinepyauth import get_token
import requests

result = get_token("eden")
headers = {"Authorization": f"Bearer {result.access_token}"}
response = requests.get("https://api.example.com/data", headers=headers)

Using with zarr/xarray (netrc support)

For services like CacheB that work with zarr, you can write credentials to ~/.netrc:

from destinepyauth import get_token
import xarray as xr

# Authenticate and write to ~/.netrc
get_token("cacheb", write_netrc=True)

# Now zarr/xarray will use credentials automatically
ds = xr.open_dataset(
    "reference://",
    engine="zarr",
    backend_kwargs={
        "consolidated": False,
        "storage_options": {
            "fo": "https://cacheb.dcms.destine.eu/path/to/data.json",
            "remote_protocol": "https",
            "remote_options": {"client_kwargs": {"trust_env": True}},
        },
    },
)

Available Services

  • cacheb - CacheB data service
  • dea - DEA service
  • eden - Eden broker
  • highway - Highway service (includes token exchange)
  • insula - Insula service
  • streamer - Streaming service

Credential Handling

When you call get_token(), the library will prompt for your credentials with masked input for both username and password - nothing you type will be visible on screen:

from destinepyauth import get_token
result = get_token("highway")
# Username:   (hidden input)
# Password:   (hidden input)

This ensures credentials cannot be accidentally exposed in terminal logs, screen recordings, or shell history.

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

destinepyauth-0.2.0.tar.gz (18.6 kB view details)

Uploaded Source

Built Distribution

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

destinepyauth-0.2.0-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file destinepyauth-0.2.0.tar.gz.

File metadata

  • Download URL: destinepyauth-0.2.0.tar.gz
  • Upload date:
  • Size: 18.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for destinepyauth-0.2.0.tar.gz
Algorithm Hash digest
SHA256 5e20d939b533522b8d752dfec1fc60c5558cba521caff26612d59df6cf3d01da
MD5 273677a5f045cba45cd97b78860509c9
BLAKE2b-256 fcdd53a7057a74084ef25875c3b1ed6bfc757bb255fda5c6063195d0456e7410

See more details on using hashes here.

File details

Details for the file destinepyauth-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: destinepyauth-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 16.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for destinepyauth-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d393dd5d879ecdb28e1d7018080450d8b63a69e3502dc945348260a252acab0c
MD5 a7b50c3b3229b6a459438d621a4b5230
BLAKE2b-256 fc7e63e1f6c7679c0703b48d674daaa2de22755a88b89ad3e06ab35f939fab97

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