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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file magento_2-0.0.2.tar.gz.
File metadata
- Download URL: magento_2-0.0.2.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e7046130d4dd491c220931102e63bffc7f6686c1690c49b745a1e8d216584e4
|
|
| MD5 |
0dcc106c1fa3f9246a652c5600148bd3
|
|
| BLAKE2b-256 |
d4703df00c7ac2144aad149e4ae8135776863ecd617a77d44385722d7b4ea7f0
|
File details
Details for the file magento_2-0.0.2-py3-none-any.whl.
File metadata
- Download URL: magento_2-0.0.2-py3-none-any.whl
- Upload date:
- Size: 2.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
43314592ce3f2b9d0c0053a30fab2cb09b5cc405df52b28af9160d2c6f41c5cd
|
|
| MD5 |
a24854f99ef371ea7ee7635e41ffb396
|
|
| BLAKE2b-256 |
68f87d7edd667daf2b50f9941a197a1d1ff4087f8653913990e0e261f92237e0
|