Skip to main content

A python module for interacting with the Magento 2 REST API. GUI

Project description

Magento 2 API Package

Overview

This package provides an interface for interacting with the Magento 2 API, allowing you to perform various operations such as logging in, making API requests, and handling data. It is designed to simplify interactions with the Magento 2 API by managing authentication and making HTTP requests.

Features

  • User authentication with Magento 2 API
  • Making various types of API requests (GET, POST, PUT, DELETE)
  • Token-based session management
  • Handling API responses and errors

Installation

To use this package, you need to have Python installed on your system. Install the package using pip:

bash

Copy code

pip install magento-2

Alternatively, clone the repository and install it manually:

bash

Copy code

git clone https://github.com/Gunn1/Magento-2-API.git cd Magento-API pip install .

Usage

Authentication

The LoginController class handles user authentication and manages the login session. Here's how you can use it:

`from magento_2 import magento.LoginController, magento.Magento

Initialize the LoginController with your Magento credentials

login_controller = LoginController(username='your_username', password='your_password')

Log in to Magento

login_controller.login()

Check if the user is logged in

if login_controller.is_logged_in(): print("User is logged in.") else: print("User is not logged in.")`

Making API Requests

Once authenticated, you can make API requests using the Magento class. Here's an example:

`from magento_2 import magento.Magento

Initialize the Magento class with the LoginController

magento = Magento(login_controller=login_controller)

Make a GET request to the API

response = magento.make_api_request( endpoint='https://your-magento-store.com/rest/V1/orders', request_type='get' )

print(response)`

Contributing

Contributions are welcome! Please submit a pull request or open an issue to report bugs or request new features.

License

This package is licensed under the MIT License. See the LICENSE file for more details.

Contact

For questions or support, please contact tylerjgunn@gmail.com.

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_2-0.0.4.tar.gz (28.3 kB view details)

Uploaded Source

Built Distribution

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

magento_2-0.0.4-py3-none-any.whl (26.3 kB view details)

Uploaded Python 3

File details

Details for the file magento_2-0.0.4.tar.gz.

File metadata

  • Download URL: magento_2-0.0.4.tar.gz
  • Upload date:
  • Size: 28.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for magento_2-0.0.4.tar.gz
Algorithm Hash digest
SHA256 9f3489eb3138c7cda04b0d2ec32553825615479be8e6e79686747f4d55998e5b
MD5 43113583481f5b5bf8be4fcf7cebf960
BLAKE2b-256 4a1777bc63eb634e6de15dc16d57f1bca83068f80526395879e8daecc8e60c83

See more details on using hashes here.

File details

Details for the file magento_2-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: magento_2-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 26.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for magento_2-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 e5df47611fe103a865adaf6f2539e1619bfc233e9d7cd7dbe495c0f9e0017ff3
MD5 cc5b9d1ba629c8e2b05b8d3d0c98b5b5
BLAKE2b-256 2137395462dfca539f3cce78bb2bf4522431d980845939916a57f27caef65f09

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