Skip to main content

API wrapper for Magento written in Python

Project description

magento-python

magento-python is an API wrapper for Magento written in Python

Installing

pip install magento-python

Usage

from magento.client import Client

client = Client('SERVER_URL', 'ACCESS_TOKEN') # Host must have trailing slash

Search product

All

response = client.search_product({'searchCriteria': ''})

Order by created_at, just one item

response = client.search_product({'searchCriteria[sortOrders][0][field]': 'created_at', 'searchCriteria[pageSize]': '1'})

Filter by created_date greater than 2018-02-26 15:31:09, up to 100 items

response = client.search_product({'searchCriteria[filter_groups][0][filters][0][field]': 'created_at', 'searchCriteria[filter_groups][0][filters][0][value]': '2018-02-26 15:31:09', 'searchCriteria[filter_groups][0][filters][0][condition_type]': 'gt', 'searchCriteria[pageSize]': '100'})

Create Product

data = {
    "product": {
        "name": 'Perfume Antonio Banderas',
        "sku": 'PAB',
        'type_id': 'simple',
        'attribute_set_id': '4',
        'price': '100000'
    }
}
response = client.create_product(data)

Get Product

By SKU

response = client.get_product('SKU')

Delete Product

By SKU

response = client.delete_product('SKU')

Search customer

All

response = client.search_customer({'searchCriteria': ''})

Create customer

data = {
    "customer": {
        "email": "janedoe@jd.com",
        "firstname": "Jane",
        "lastname": "Doe",
        "addresses": [{
            "defaultShipping": True,
            "defaultBilling": True,
            "firstname": "Jane",
            "lastname": "Doe",
            "region": {
                "regionCode": "NY",
                "region": "New York",
                "regionId": 43
            },
            "postcode": "10755",
            "street": ["123 Oak Ave"],
            "city": "Purchase",
            "telephone": "512-555-1111",
            "countryId": "US"
        }]
    },
    "password": "Password1"
}
response = client.create_customer(data)

Get customer

By ID

response = client.get_customer('CUSTOMER_ID')

Delete Product

By ID

response = client.delete_customer('CUSTOMER_ID')

Search order

All

response = client.search_order({'searchCriteria': ''})

Get order

By ID

response = client.get_order('ORDER_ID')

Get product types

All

response = client.get_product_types({'searchCriteria': ''})

Get product attribute sets

All

response = client.get_product_attribute_sets({'searchCriteria': ''})

Get customer groups

All

response = client.get_customer_groups({'searchCriteria': ''})

Contributing

We are always grateful for any kind of contribution including but not limited to bug reports, code enhancements, bug fixes, and even functionality suggestions.

You can report any bug you find or suggest new functionality with a new issue.

If you want to add yourself some functionality to the wrapper:

  1. Fork it ( https://github.com/GearPlug/magento-python )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Adds my new feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

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

magento_python-0.1.1.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

magento_python-0.1.1-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file magento_python-0.1.1.tar.gz.

File metadata

  • Download URL: magento_python-0.1.1.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for magento_python-0.1.1.tar.gz
Algorithm Hash digest
SHA256 784d98659e8479bc31777e4033e959f121382699d3bc67e4354c02cfdd5bf625
MD5 964aca239888a92ceb31f8bd143ff912
BLAKE2b-256 bd37a697c790a7a2848c38214e7b9addbc1d35b7664fd82d40228e90fca372de

See more details on using hashes here.

File details

Details for the file magento_python-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for magento_python-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a473bce68fdde98ce43db893caddc33e7df04151fc8d2c941945aa9ac2d08ef7
MD5 7bd631c19227e0a27bdb43f75a246d42
BLAKE2b-256 bb42f1f083fb90a93768e65774e3dbb89381fa5eed0f59c4b40fc8e8cc0eb7b3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page