Python Magento 2 REST API Wrapper
Project description
A Python package that wraps and extends the Magento 2 REST API
About MyMagento
MyMagento simplifies interaction with the Magento 2 REST API
If you’ve worked with the Magento 2 API, you’ll know that not all endpoints are created equally.
MyMagento aims to streamline your workflow by simplifying a variety of commonly needed API operations.
Main Components
Available Endpoints
The following endpoints are currently wrapped with a Model and SearchQuery subclass
Endpoint |
Client Attribute |
SearchQuery Subclass |
Model Subclass |
|
---|---|---|---|---|
orders |
Client.orders |
|||
orders/items |
Client.order_items |
|||
invoices |
Client.invoices |
|||
products |
Client.products |
|||
products/attributes |
Client.product_attributes |
|||
categories |
Client.categories |
…
Installation
Documentation
Full documentation can be found on ReadTheDocs
…
QuickStart: Login with MyMagento
💡 Tip |
|
---|---|
See logging-in for full details on generating an access token |
Setting the Login Credentials
The credentials of your Magento 2 admin account are used to initialize and authenticate() a Client
>> domain = 'website.com'
>> username ='username'
>> password = 'password'
If you’re using a local installation of Magento, your domain should look like this:
>> domain = '127.0.0.1/path/to/magento'
Getting a Client
MyMagento uses the Client in one of two ways
Method 1: Initialize a Client
from magento import Client
>>> api = Client(domain, username, password)
|[ MyMagento | website_username ]|: Authenticating username on website.com...
|[ MyMagento | website_username ]|: Logged in to username
Method 2: Initialize a Client with get_api()
The get_api() method uses the same keyword arguments as the Client, but will try using environment variable values if the domain, username, or password are missing
import magento
>>> api = magento.get_api()
|[ MyMagento | website_username ]|: Authenticating username on website.com...
|[ MyMagento | website_username ]|: Logged in to username
Now let’s start interacting with the api
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for my_magento-2.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | efdcbc1333e06a1b7410d837b3f7098644870376ac0ae3034dd40674ea0a0c25 |
|
MD5 | a32f12ec1e172e84d6f2525e8d956c14 |
|
BLAKE2b-256 | cd50bce00d526e43d5af20064db31acd106cb72435b7a33a18cfa6e3d36f8ded |