Skip to main content

SoftwareOne Marketplace API Client for Python

Project description

mpt-api-python-client

A Python client for interacting with the MPT API.

Installation

Install as a uv dependency:

uv add mpt-api-client
cp .env.example .env

Usage

from 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)

Async Usage

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())

Development

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.txt

Testing

Run all validations with:

docker compose run --rm app_test

Run pytest with:

pytest tests/unit
pytest tests/e2e
pytest tests/seed

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

mpt_api_client-0.0.2.tar.gz (37.6 kB view details)

Uploaded Source

Built Distribution

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

mpt_api_client-0.0.2-py3-none-any.whl (75.0 kB view details)

Uploaded Python 3

File details

Details for the file mpt_api_client-0.0.2.tar.gz.

File metadata

  • Download URL: mpt_api_client-0.0.2.tar.gz
  • Upload date:
  • Size: 37.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.7.22

File hashes

Hashes for mpt_api_client-0.0.2.tar.gz
Algorithm Hash digest
SHA256 26e81f7ceaaffaaf36863fc27c87bbb7de8b59503dc4379a4c6d3c06a129c3eb
MD5 71dc3f2e9c5d2d60099356d19cc8c10a
BLAKE2b-256 5f4113607efff5104bb57b78bf660883d818b65129825f8978f0516c9218e49d

See more details on using hashes here.

File details

Details for the file mpt_api_client-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for mpt_api_client-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a1763598cb60a284154bdc0423f1dcee0b871a2f51fd61b6a0e7db091237dd70
MD5 504878abca710949648f941aaff759b6
BLAKE2b-256 e21ff58c440309ecea970d2fc4dd4ab621fce2ab7d18dbade400aee38717352a

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