Skip to main content

Eduzz Miau Client for Python

Project description

eduzz-miau-client

Python client for the Eduzz Miau authentication service.

Installation

pip install eduzz-miau-client

Usage

from eduzz_miau_client import MiauClient

client = MiauClient(
    api_url="https://your-miau-api-url",
    app_secret="your-app-secret",
)

token = client.get_token()

Or using a context manager:

with MiauClient(api_url="https://your-miau-api-url", app_secret="your-app-secret") as client:
    token = client.get_token()

Example

import httpx
import json
import os
from eduzz_miau_client import MiauClient

MIAU_API_URL = os.environ.get('MIAU_API_URL')
MIAU_APP_SECRET = os.environ.get('MIAU_APP_SECRET', '')
YOUR_API_URL = os.environ.get('YOUR_API_URL', 'https://your-api.example.com')

client = MiauClient(api_url=MIAU_API_URL, app_secret=MIAU_APP_SECRET)
token = client.get_token()

http = httpx.Client()
response = http.get(YOUR_API_URL+'/your/endpoint', headers={'Authorization': f'Bearer {token}'})
print(json.dumps(response.json(), indent=2, ensure_ascii=False))

API

MiauClient(api_url, app_secret)

Creates a new client instance.

Parameter Type Description
api_url str Miau API base URL
app_secret str Application secret from Miau

client.get_token() -> str

Returns a valid JWT access token. Tokens are cached in memory and automatically refreshed when they are within 60 seconds of expiration.

client.close()

Closes the underlying HTTP client. Called automatically when using the context manager.

Requirements

  • Python >= 3.10

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

eduzz_miau_client-1.4.3.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

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

eduzz_miau_client-1.4.3-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

Details for the file eduzz_miau_client-1.4.3.tar.gz.

File metadata

  • Download URL: eduzz_miau_client-1.4.3.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for eduzz_miau_client-1.4.3.tar.gz
Algorithm Hash digest
SHA256 81b7dd78682ca82ac15edc1cfa47bab06fe863f84099a04bd37db78b32921f13
MD5 118b0646b47009e26ccb691740bfe942
BLAKE2b-256 6fb2a5d1f49e114e49808bb917dc7220ca0ada3ebb66e6c9f06ceec3cc9a92f1

See more details on using hashes here.

File details

Details for the file eduzz_miau_client-1.4.3-py3-none-any.whl.

File metadata

File hashes

Hashes for eduzz_miau_client-1.4.3-py3-none-any.whl
Algorithm Hash digest
SHA256 006f988fdfbc773c0d5a570fab4208c1093177633d7b0a27819b1eeff5850163
MD5 6a563c7e7389ab34088d326cc710148f
BLAKE2b-256 e3b5b10db9609cc881ec832782b0cfc9405cba8fe9863b04ded98e33130b1617

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