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.3rc12.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.3rc12-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: eduzz_miau_client-1.4.3rc12.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.3rc12.tar.gz
Algorithm Hash digest
SHA256 5ba5d81da09f6d422a9f4ae473d89c4d1805d1010e8591e0a09ad41bcf479338
MD5 47327ecff255d38f80aeeca36deac99c
BLAKE2b-256 7146e9e19552395527a882b975b077c05ff0ad07e187f43f9cf2ea70a084bb8d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for eduzz_miau_client-1.4.3rc12-py3-none-any.whl
Algorithm Hash digest
SHA256 6382a829f15b17a9a087184581ccef0ba4bc07ca145f8c10fdbab0ca7a260b22
MD5 bf062f3daa15b573bcb4c88514be9d03
BLAKE2b-256 9fae22c31a64854ce23a1bbca9dc9fa8a4d7e47671b816fa11aba6e8dc6a147c

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