pymagento


Namepymagento JSON
Version 1.11.0 PyPI version JSON
download
home_pagehttps://github.com/Bixoto/PyMagento
SummaryPython client for the Magento 2 API
upload_time2024-04-12 08:32:28
maintainerNone
docs_urlNone
authorBixoto
requires_python<4.0,>=3.8
licenseMIT
keywords magento magento-api python-magento magento-python pymagento py-magento magento2 magento-2 magento2-api magento2-rest-api magento-rest-api
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PyMagento

[![PyPI version](https://img.shields.io/pypi/v/pymagento)](https://pypi.org/project/pymagento/) [![PyPI downloads](https://img.shields.io/pypi/dm/pymagento)](https://pypi.org/project/pymagento/)

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

* [Read the docs](https://pymagento2.readthedocs.io/)

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

```python
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](https://pymagento2.readthedocs.io/).

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](https://bixoto.com/). See [`LICENSE`](./LICENSE).

## Other projects

* [MyMagento](https://github.com/TDKorn/my-magento): new project started in 2022; MyMagento didn’t exist when we started PyMagento.
  This is a more high-level API that can be a good fit if you’re not familiar with Magento’s API.
* [PyMagento-REST](https://pypi.org/project/PyMagento-REST/) (abandoned)
* [bialecki/pymagento](https://github.com/bialecki/pymagento): Magento 1.x only (abandoned)
* [python-magento](https://github.com/bernieke/python-magento): Magento 1.x only (abandoned)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Bixoto/PyMagento",
    "name": "pymagento",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": null,
    "keywords": "magento, magento-api, python-magento, magento-python, pymagento, py-magento, magento2, magento-2, magento2-api, magento2-rest-api, magento-rest-api",
    "author": "Bixoto",
    "author_email": "tech@bixoto.com",
    "download_url": "https://files.pythonhosted.org/packages/a0/77/377ea0c3e6dadcb8a5a9dd0e392a42dbbd32026c7d280c6c74176b5997a2/pymagento-1.11.0.tar.gz",
    "platform": null,
    "description": "# PyMagento\n\n[![PyPI version](https://img.shields.io/pypi/v/pymagento)](https://pypi.org/project/pymagento/) [![PyPI downloads](https://img.shields.io/pypi/dm/pymagento)](https://pypi.org/project/pymagento/)\n\n**PyMagento** is a Python client for the Magento 2 API. Its goal is to provide an easy-to-use Pythonic interface\nto the Magento 2 API, while being lightweight and extendable.\n\n* [Read the docs](https://pymagento2.readthedocs.io/)\n\nFeatures:\n* Lightweight: entities are returned as plain dictionaries; there is no custom `Order` or `Product` class\n* Easy to extend: subclass `magento.Magento` and add your own methods\n* Transparent pagination: functions that make paginated queries return lazy iterables (generators)\n* Fully typed: all functions have type hints if necessary\n* Production-ready: at Bixoto, we use PyMagento in production since 2020\n* Python 3.8+ support\n* MIT license\n\nNote: PyMagento is not affiliated to nor endorsed by Adobe or the Magento team.\n\n## Install\n\n### Pip\n\n    python -m pip install pymagento\n\n### Poetry\n\n    poetry add pymagento\n\n## Usage\n\n```python\nimport magento\n\nclient = magento.Magento(base_url=\"...\", token=\"...\", scope=\"all\")\n\nproduct = client.get_product(\"SKU123\")\nprint(magento.get_custom_attribute(product, \"description\"))\n\n# Get orders by status\nfor order in client.get_orders(status=\"processing\"):\n    print(order[\"increment_id\"], order[\"grand_total\"])\n\n# Make more complex queries\nquery = magento.make_search_query([\n    [(\"customer_email\", \"billgates@example.com\", \"eq\")],\n    [(\"status\", \"complete\", \"eq\")],\n])\n\nfor order in client.get_orders(query=query, limit=10):\n    print(order[\"increment_id\"], len(order[\"items\"]))\n```\n\nFor more information, [read the docs](https://pymagento2.readthedocs.io/).\n\nNote: not all endpoints are implemented with dedicated methods. You can call them with\n`client.get_json_api(\"/V1/...\")` for `GET` endpoints and `client.post_json_api(\"/V1/...\", json=...)`.\n\n## License\n\nCopyright 2020-2024 [Bixoto](https://bixoto.com/). See [`LICENSE`](./LICENSE).\n\n## Other projects\n\n* [MyMagento](https://github.com/TDKorn/my-magento): new project started in 2022; MyMagento didn\u2019t exist when we started PyMagento.\n  This is a more high-level API that can be a good fit if you\u2019re not familiar with Magento\u2019s API.\n* [PyMagento-REST](https://pypi.org/project/PyMagento-REST/) (abandoned)\n* [bialecki/pymagento](https://github.com/bialecki/pymagento): Magento 1.x only (abandoned)\n* [python-magento](https://github.com/bernieke/python-magento): Magento 1.x only (abandoned)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python client for the Magento 2 API",
    "version": "1.11.0",
    "project_urls": {
        "Homepage": "https://github.com/Bixoto/PyMagento"
    },
    "split_keywords": [
        "magento",
        " magento-api",
        " python-magento",
        " magento-python",
        " pymagento",
        " py-magento",
        " magento2",
        " magento-2",
        " magento2-api",
        " magento2-rest-api",
        " magento-rest-api"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6aa3b349d1d9a2c455f1f48649e0b9beeddccd88a876ea591de5470297a06291",
                "md5": "5089423d4da82f4c427487ac1b6ff2a8",
                "sha256": "446166102abaef7c48838aab430ea2e5fc2b62722ba3e435175c00b5fc6d4fcd"
            },
            "downloads": -1,
            "filename": "pymagento-1.11.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5089423d4da82f4c427487ac1b6ff2a8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 21643,
            "upload_time": "2024-04-12T08:32:27",
            "upload_time_iso_8601": "2024-04-12T08:32:27.657587Z",
            "url": "https://files.pythonhosted.org/packages/6a/a3/b349d1d9a2c455f1f48649e0b9beeddccd88a876ea591de5470297a06291/pymagento-1.11.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a077377ea0c3e6dadcb8a5a9dd0e392a42dbbd32026c7d280c6c74176b5997a2",
                "md5": "d37e9f4849e08d30b43cf342a1cb1746",
                "sha256": "23a2586cb12bf1b99c5088cd9f1781db1735b19ea5b29c06dab90ca68e22f30a"
            },
            "downloads": -1,
            "filename": "pymagento-1.11.0.tar.gz",
            "has_sig": false,
            "md5_digest": "d37e9f4849e08d30b43cf342a1cb1746",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 20297,
            "upload_time": "2024-04-12T08:32:28",
            "upload_time_iso_8601": "2024-04-12T08:32:28.756063Z",
            "url": "https://files.pythonhosted.org/packages/a0/77/377ea0c3e6dadcb8a5a9dd0e392a42dbbd32026c7d280c6c74176b5997a2/pymagento-1.11.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-12 08:32:28",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Bixoto",
    "github_project": "PyMagento",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pymagento"
}
        
Elapsed time: 0.28101s