A Python library for weaving multiple API responses into unified data structures with automatic field mapping and conflict resolution.
apiloom simplifies aggregating data from multiple REST APIs by providing declarative schema mapping, automatic type conversion, and intelligent field merging to reduce boilerplate code when building composite data views.
git clone https://github.com/yourusername/apiloom.git
cd apiloom
pip install -e .Or install from PyPI:
pip install apiloomfrom apiloom import Loom, Schema
# Define your API schemas
user_schema = Schema({
'name': {'source': 'user.full_name', 'type': 'string'},
'email': {'source': 'user.email_address', 'type': 'string'},
'age': {'source': 'profile.age', 'type': 'int'}
})
# Create a Loom instance
loom = Loom(cache_ttl=300)
# Weave multiple API responses
result = loom.weave([
{'url': 'https://api.example.com/user/123'},
{'url': 'https://api.example.com/profile/123'}
], schema=user_schema)
print(result)- Declarative Schemas: Define API mappings using YAML/JSON
- Automatic Type Coercion: Convert fields to specified types
- Conflict Resolution: Intelligent merging strategies for duplicate fields
- Response Caching: Built-in TTL-based caching layer
- Retry Logic: Exponential backoff for failed requests
See docs/ for detailed documentation and examples.