Python client library for APIGEE Service
Project description
APIGEE Client SDK
Python client library for interacting with APIGEE through a centralized service.
Features
- 🔐 OAuth2 Token Management - Automatic token fetching and caching
- 🚀 API Proxying - Seamless API calls through APIGEE gateway
- ⚡ FastAPI Integration - Built-in router for automatic endpoint proxying
- 🎯 Type Safe - Full type hints and Pydantic validation
- 🔄 Async/Await - Modern async Python support
- 📦 Zero Configuration - Works out of the box
Installation
pip install sso-apigee-client
With FastAPI Support
pip install sso-apigee-client[fastapi]
Quick Start
Basic Usage
import asyncio
from sso_apigee_client import ApigeeClient
async def main():
# Initialize client
client = ApigeeClient("http://localhost:8000")
try:
# Get APIGEE token
token = await client.get_token()
print(f"Token: {token}")
# Make API call through APIGEE
data = await client.call_api(
method="GET",
endpoint="/api/v1/users",
query_params={"page": 1}
)
print(f"Data: {data}")
finally:
await client.close()
asyncio.run(main())
Using Context Manager
async with ApigeeClient("http://localhost:8000") as client:
users = await client.call_api("GET", "/api/v1/users")
print(users)
FastAPI Integration
from fastapi import FastAPI
from sso_apigee_client import ApigeeClient, ApigeeRouter
app = FastAPI()
apigee = ApigeeClient("http://localhost:8000")
# Create router with automatic proxying
router = ApigeeRouter(
apigee_client=apigee,
apigee_base_path="/api/v1",
prefix="/api"
)
@router.get("/users")
async def get_users():
# Automatically proxied through APIGEE!
pass
@router.get("/users/{user_id}")
async def get_user(user_id: str):
# Path params automatically handled!
pass
app.include_router(router)
API Reference
ApigeeClient
Methods
get_token(force_refresh=False)- Get APIGEE OAuth2 access tokencall_api(method, endpoint, **kwargs)- Make authenticated API call via proxyget_token_status()- Get current token statushealth_check()- Check service healthclose()- Close HTTP client
ApigeeRouter
FastAPI router that automatically proxies all requests through APIGEE.
Parameters
apigee_client- ApigeeClient instanceapigee_base_path- Base path for APIGEE endpointsauto_proxy- Enable automatic proxying (default: True)prefix- FastAPI router prefixtags- OpenAPI tags
Route Decorators
@router.get(path)- GET endpoint@router.post(path)- POST endpoint@router.put(path)- PUT endpoint@router.delete(path)- DELETE endpoint
Special Parameters
apigee_endpoint- Override APIGEE endpoint pathskip_apigee- Skip APIGEE proxying for specific route
Configuration
The SDK requires an APIGEE service running. Set up the service:
# Clone the service repository
git clone https://github.com/yourorg/sso-apigee-service
# Configure environment
cp .env.example .env
# Edit .env with your APIGEE credentials
# Run with Docker
docker-compose up -d
Requirements
- Python 3.11+
- httpx >= 0.25.0
- pydantic >= 2.5.0
- fastapi >= 0.104.0 (optional, for FastAPI integration)
License
MIT License
Support
For issues and questions:
- GitHub Issues: https://github.com/yourorg/sso-apigee-client/issues
- Documentation: https://github.com/yourorg/sso-apigee-service
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sso_apigee_client-1.0.2.tar.gz.
File metadata
- Download URL: sso_apigee_client-1.0.2.tar.gz
- Upload date:
- Size: 11.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e95d9d097c1c8006b91dc0ebf159f6c83d7aafb01fcaa43bb7121ee61c8d6d8b
|
|
| MD5 |
df79a691ef472e1dad9aee3b51c7609d
|
|
| BLAKE2b-256 |
20539407b7f0719eac8f5060322e2b5fafad365c0d4b729413c1b2ba896c7931
|
File details
Details for the file sso_apigee_client-1.0.2-py3-none-any.whl.
File metadata
- Download URL: sso_apigee_client-1.0.2-py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02cdb8ed79fc74550c9224a05f603a6c1cf6d24e0300c8490272bd38b1b7907d
|
|
| MD5 |
4dc00ce3c5112b1102ad44f53b12f315
|
|
| BLAKE2b-256 |
3c3bea29394bb0fb51947518482f4fa9507e508c334a8ee2fb06be4d029b92e1
|