oceana_token
Oceana API library to manage authentication token and headers
Setup
Install latest version
pip install oceana_token
Usage
Create authentication headers:
from oceana_token import *
import json
# Authentication in Oceana API
oceana_api_client = Authenticate(url="http://127.0.0.1:5000",
client_id="oceana-api-client",
client_secret="bad_password",
api_version="v1")
token = oceana_api_client.get_token()
# Create headers
headers = oceana_api_client.headers(headers={})
# Add authentication header
headers = oceana_api_client.authorization_header(headers={})
# Create headers from template
headers = json.loads(oceana_api_auth_header.format(token=f"Bearer {oceana_api_client.get_token()}"))
Request an endpoint:
import requests
headers = ...
response = requests.get(url="http://127.0.0.1:5000/v1/organization/id/1", headers=headers, verify=False)
Environment
Properties in environment variables:
# Example
OCEANA_API_URL="http://127.0.0.1:5000"
OCEANA_API_CLIENT_ID="oceana-api-client"
OCEANA_API_CLIENT_SECRET="bad_password"
OCEANA_API_VERSION="v1"
OCEANA_API_LOGGER_LEVEL="DEBUG"
OCEANA_API_LOGGER_FORMAT="%(asctime)s - [%(name)-25s] - %(levelname)-5s - %(message)s"
Packaging
Build package
# Using build package
python -m build
Run tests
# All tests
pytest -q -rP
# Partial tests
pytest tests/unit/test_authentication.py -v -rP
pytest tests/unit/test_header.py -v -rP
pytest tests/unit/test_jwt.py -v -rP
# Reinstall avoiding reinstalling dependencies
pip install --upgrade --no-deps --force-reinstall dist\oceana_token-0.0.5-py3-none-any.whl
# Reinstall with dependencies
pip install dist\oceana_token-0.0.5-py3-none-any.whl --force-reinstall
Check style guide enforcement
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
Dependencies
| Library | Version |
|---|---|
| requests | >= 2.29.0 |
| python-decouple | == 3.8 |
Releases
Version 0.0.5:
- Python upgraded ["3.9", "3.10", "3.11"] -> ["3.12", "3.13", "3.14"]
- Upgrading libraries dependencies Version 0.0.4:
- Added configurable API version Version 0.0.3:
- First version
Metadata
Release files for oceana-token 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| oceana_token-0.0.5.tar.gz | 8.0 kB | Without provenance | Details for oceana_token-0.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| oceana_token-0.0.5-py3-none-any.whl | Python 3 | none | any | Details for oceana_token-0.0.5-py3-none-any.whl |
Total release size: 14.8 kB
Release files / oceana_token-0.0.5.tar.gz
| Download URL | oceana_token-0.0.5.tar.gz |
|---|---|
| Size | 8.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a10e733fd73a45946ecf9fcb366d60528c81f342ce0adbfdb8515627ffa81146
|
|
BLAKE2b-256 checksum How to use checksums |
4cee78bcfbac75ff89ccd7986603dea42f55d2ff157fd906cd87a408645cbe5a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Release files / oceana_token-0.0.5-py3-none-any.whl
| Download URL | oceana_token-0.0.5-py3-none-any.whl |
|---|---|
| Size | 6.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8d0342412d8787f844faca9c8b1318918742ed2d1ad68fe1bed9a8d0df94039a
|
|
BLAKE2b-256 checksum How to use checksums |
7dc3a92a74fd2fcabe17e268268b3dc5fd3ee750eb4a277bf041f57e3caf0be5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Security for oceana-token 0.0.5
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.