Skip to main content

Python client for the Magento 2 API

Project description

PyMagento

PyPI version PyPI downloads

PyMagento is a Python client for the Magento 2 API. Its goal is to provide an easy-to-use Pythonic interface to the Magento 2 API, while being lightweight and extendable.

Features:

  • Lightweight: entities are returned as plain dictionaries; there is no custom Order or Product class
  • Easy to extend: subclass magento.Magento and add your own methods
  • Transparent pagination: functions that make paginated queries return lazy iterables (generators)
  • Fully typed: all functions have type hints
  • Production-ready: at Bixoto, we use PyMagento in production since 2020
  • Python 3.10+ support
  • MIT license

Note: PyMagento is not affiliated to nor endorsed by Adobe or the Magento team.

Install

Pip

python -m pip install pymagento

uv

uv add pymagento

Poetry

poetry add pymagento

Usage

import magento

# To get a token, create an integration and copy the "Access Token"
client = magento.Magento(base_url="...", token="...", scope="all")

product = client.get_product("SKU123")
print(magento.get_custom_attribute(product, "description"))

# Get orders by status
for order in client.get_orders(status="processing"):
    print(order["increment_id"], order["grand_total"])

# Make more complex queries
query = magento.make_search_query([
    [("customer_email", "billgates@example.com", "eq")],
    [("status", "complete", "eq")],
])

for order in client.get_orders(query=query, limit=10):
    print(order["increment_id"], len(order["items"]))

For more information, read the docs.

Note: not all endpoints are implemented with dedicated methods. You can call them with client.get_json_api("/V1/...") for GET endpoints and client.post_json_api("/V1/...", json=...).

License

Copyright 2020-2025 Bixoto. See the LICENSE.

Other projects

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

pymagento-2.13.0.tar.gz (26.1 kB view details)

Uploaded Source

Built Distribution

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

pymagento-2.13.0-py3-none-any.whl (28.8 kB view details)

Uploaded Python 3

File details

Details for the file pymagento-2.13.0.tar.gz.

File metadata

  • Download URL: pymagento-2.13.0.tar.gz
  • Upload date:
  • Size: 26.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pymagento-2.13.0.tar.gz
Algorithm Hash digest
SHA256 7848b55e04cfd2164a2b3fee9a21f448d042cac8d9f1ca1571c639969694c07b
MD5 d7c690f6d6c1f6860c7dc98f60f3d4b7
BLAKE2b-256 e9a43156a8b32591603a2d1b7278b7856bdc712b2431811c6fd1609fab9ca215

See more details on using hashes here.

File details

Details for the file pymagento-2.13.0-py3-none-any.whl.

File metadata

  • Download URL: pymagento-2.13.0-py3-none-any.whl
  • Upload date:
  • Size: 28.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pymagento-2.13.0-py3-none-any.whl
Algorithm Hash digest
SHA256 34952a8b978006856e3208df91d784c1850bfe289044e5e13c94ec02b5779c0d
MD5 b9d65ef1a4e8053ce7bb8d27c5df9db7
BLAKE2b-256 a58aa97313d92c51ebdb364b7b32fc1700c674ba457ebe1b330a8dd38db7ceb4

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