Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pymagento

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pymagento

Python client for the Magento 2 API

  • 2.1.0
  • PyPI
  • Socket score

Maintainers
1

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 if necessary
  • Production-ready: at Bixoto, we use PyMagento in production since 2020
  • Python 3.8+ support
  • MIT license

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

Install

Pip

python -m pip install pymagento

Poetry

poetry add pymagento

Usage

import magento

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-2024 Bixoto. See the LICENSE.

Other projects

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc