A client library for accessing Field Manager Data API
Project description
field-manager-python-client
A client library for accessing Field Manager Data API
🚀 Quick Start
Installation
pip install field_manager_python_client python-keycloak
Authentication
The easiest way to get started is using the built-in authentication functions:
from field_manager_python_client import get_prod_client
# Authenticate with your Field Manager account
client = get_prod_client(email="your.email@example.com")
Basic Usage
from field_manager_python_client.api.projects import get_project_projects_project_id_get
# Use the authenticated client
project_info = get_project_projects_project_id_get.sync(
client=client,
project_id="your-project-id"
)
print(f"Project: {project_info.name}")
🔐 Authentication Options
1. Integrated Authentication (Recommended)
from field_manager_python_client import authenticate
client = authenticate(environment="prod", email="user@example.com")
2. Manual Token Setup
from field_manager_python_client import AuthenticatedClient
client = AuthenticatedClient(
base_url="https://app.fieldmanager.io/api/location",
token="your-access-token"
)
3. Service Account (for automation)
See the main repository for service account setup.
📖 API Usage Patterns
Synchronous Operations
from field_manager_python_client.api.organizations import get_organizations_organizations_get
# Simple request - returns data or None
organizations = get_organizations_organizations_get.sync(client=client)
# Detailed request - returns Response object with status code, headers, etc.
from field_manager_python_client.types import Response
response: Response = get_organizations_organizations_get.sync_detailed(client=client)
if response.status_code == 200:
organizations = response.parsed
Asynchronous Operations
import asyncio
from field_manager_python_client.api.organizations import get_organizations_organizations_get
async def fetch_organizations():
# Simple async request
organizations = await get_organizations_organizations_get.asyncio(client=client)
# Detailed async request
response = await get_organizations_organizations_get.asyncio_detailed(client=client)
return response.parsed
# Run async function
organizations = asyncio.run(fetch_organizations())
🛠️ Advanced Features
SSL Configuration
from field_manager_python_client import AuthenticatedClient
# Custom certificate bundle
client = AuthenticatedClient(
base_url="https://internal.example.com/api",
token="token",
verify_ssl="/path/to/certificate_bundle.pem"
)
# Disable SSL verification (not recommended for production)
client = AuthenticatedClient(
base_url="https://internal.example.com/api",
token="token",
verify_ssl=False
)
Custom HTTP Configuration
from field_manager_python_client import AuthenticatedClient
def log_request(request):
print(f"Request: {request.method} {request.url}")
def log_response(response):
print(f"Response: {response.status_code}")
client = AuthenticatedClient(
base_url="https://api.example.com",
token="token",
httpx_args={"event_hooks": {"request": [log_request], "response": [log_response]}}
)
📚 Learn More
For comprehensive documentation, examples, and contribution guidelines, visit the main repository: https://github.com/norwegian-geotechnical-institute/field-manager-python-client
The repository includes:
- 📖 Complete authentication guide
- 🔧 Advanced usage examples
- 🚀 Real-world code samples
- 🤝 Contributing guidelines
- 📋 Issue tracking and support
🔍 API Reference
Every endpoint becomes a Python function with four variants:
sync: Blocking request returning parsed data orNonesync_detailed: Blocking request returning fullResponseobjectasyncio: Async version ofsyncasyncio_detailed: Async version ofsync_detailed
All path/query parameters and request bodies become function arguments.
Functions are organized by API tags in field_manager_python_client.api.* modules.
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 field_manager_python_client-4.6.97.tar.gz.
File metadata
- Download URL: field_manager_python_client-4.6.97.tar.gz
- Upload date:
- Size: 198.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.12 Linux/6.11.0-1018-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a4df7b392e535b5c53192c0a70b9e4be066222b01d09511c19c8f8d3145a418
|
|
| MD5 |
c30ff535377aad7aa81a6b4aaa3b6e21
|
|
| BLAKE2b-256 |
b0fcb1d2653d7aa48733266a4bda937c6c79a253ba2c5ab7911fd28bf0d24945
|
File details
Details for the file field_manager_python_client-4.6.97-py3-none-any.whl.
File metadata
- Download URL: field_manager_python_client-4.6.97-py3-none-any.whl
- Upload date:
- Size: 637.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.12 Linux/6.11.0-1018-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7bb55c14d0fb1cc19b14bde9abb2a25f2d93e01d3a4ecf3e9dce6df9881769e8
|
|
| MD5 |
a42324561ba00a3da3d6a153aa4c39b5
|
|
| BLAKE2b-256 |
4458f3284dcb45bd6563694f4fecc5d0c4fbf035bf057390affdd136252ab642
|