Skip to main content

A python package for interfacing with the Edupaid API

Project description

Edupaid

A Python client for the Edupaid API.

Installation

pip install edupaid

Quick Start

from edupaid import Edupaid

# Initialize the client (uses environment variables)
client = Edupaid()

# Or pass credentials directly
client = Edupaid(
    api_key="your-api-key",
    provider_id="your-provider-id",
    jwt_secret="your-jwt-secret",
)

# Access API methods via the service
# result = client.service.get_app_authorization(...)

Configuration

Environment Variables

The client reads configuration from environment variables. Add these to your .env file or set them in your environment:

Variable Required Description
EDUPAID_API_KEY Yes API key for authentication (sent as x-api-key header)
EDUPAID_PROVIDER_ID Yes Your provider identifier
EDUPAID_JWT_SECRET Yes Secret for JWT/webhook signature verification
EDUPAID_ENVIRONMENT No production (default) or staging

Example .env file

EDUPAID_API_KEY=your-api-key-here
EDUPAID_PROVIDER_ID=your-provider-id-here
EDUPAID_JWT_SECRET=your-jwt-secret-here

Django Integration

For Django projects, ensure your environment variables are loaded before using the client:

# settings.py
import environ

env = environ.Env()
environ.Env.read_env()  # Loads .env file

# In your views/services
from edupaid import Edupaid

client = Edupaid()  # Env vars are already loaded

Error Handling

The client raises typed exceptions for different error scenarios:

from edupaid import Edupaid
from edupaid.errors import (
    ConfigurationError,  # Missing/invalid configuration
    AuthError,           # 401 Unauthorized
    ValidationError,     # 400 Bad Request
    NotFoundError,       # 404 Not Found
    RateLimitError,      # 429 Too Many Requests
    ServerError,         # 5xx Server Errors
    RequestError,        # Other HTTP errors
)

try:
    client = Edupaid()
    # result = client.service.some_method(...)
except ConfigurationError as e:
    print(f"Configuration issue: {e}")
except AuthError as e:
    print(f"Authentication failed: {e}")
except NotFoundError as e:
    print(f"Resource not found: {e}")
except ValidationError as e:
    print(f"Invalid request: {e}")

All API errors include the error message from the API response:

try:
    # ...
except NotFoundError as e:
    # Access the raw error dict from the API
    if e.error_details:
        api_message = e.error_details.get("error")

API Reference

Available Methods

The following API endpoints are available via client.service:

Method Description
get_app_authorization() Get learning track authorization for a student
list_app_authorizations() List all learning track authorizations for a student
batch_get_app_authorization() Get authorizations for multiple students
submit_token() Submit a learning token
generate_parent_token() Generate parent portal access URL

Note: Method implementations are in progress.

Requirements

  • Python >= 3.10
  • httpx
  • pydantic >= 2.0

License

MIT

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

edupaid-1.0.0.tar.gz (27.8 kB view details)

Uploaded Source

Built Distribution

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

edupaid-1.0.0-py3-none-any.whl (51.6 kB view details)

Uploaded Python 3

File details

Details for the file edupaid-1.0.0.tar.gz.

File metadata

  • Download URL: edupaid-1.0.0.tar.gz
  • Upload date:
  • Size: 27.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.3 Darwin/24.6.0

File hashes

Hashes for edupaid-1.0.0.tar.gz
Algorithm Hash digest
SHA256 8578cdc1df31989dbc540d26c9214311f375ee2a5eb0fb004b6d682a550e573f
MD5 3073cc2195ff182821d760aa54c09f86
BLAKE2b-256 4479d13cd8288dcb1221921452ba38c11766f703dc4518f0af8e876df9aead66

See more details on using hashes here.

File details

Details for the file edupaid-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: edupaid-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 51.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.3 Darwin/24.6.0

File hashes

Hashes for edupaid-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c651475c72cc911b982b9cb25bc1697d60009012183ef4e871d98d5461a7de41
MD5 2746d9072357ecbcba9f01e23a4f5bfe
BLAKE2b-256 34ab727d874cb6f3387e3f6e28913b3c1369039c695e234cf47c3664ea0355d0

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