A Python client for interacting with the MPT API.
Install as a uv dependency:
uv add mpt-api-client
cp .env.example .envfrom mpt_api_client import MPTClient
#client = MPTClient(api_key=os.getenv("MPT_API_KEY"), base_url=os.getenv("MPT_API_URL"))
client = MPTClient() # Will get the api_key and base_url from the environment variables
for product in client.catalog.products.iterate():
print(product.name)import asyncio
from mpt_api_client import AsyncMPTClient
async def main():
# client = AsyncMPTClient(api_key=os.getenv("MPT_API_KEY"), base_url=os.getenv("MPT_API_URL"))
client = AsyncMPTClient() # Will get the api_key and base_url from the environment variables
async for product in client.catalog.products.iterate():
print(product.name)
asyncio.run(main())Clone the repository and install dependencies:
git clone https://github.com/albertsola/mpt-api-python-client.git
cd mpt-api-python-client
uv add -r requirements.txtRun all validations with:
docker compose run --rm app_testRun pytest with:
pytest tests/unit
pytest tests/e2e
pytest tests/seedMIT