A SDK for integrating with Blesta
Project description
Blesta Python SDK
The Blesta Python SDK offers an intuitive API and CLI interface for seamless interaction with Blesta's REST API.
๐ Quick and Easy Setup
-
Create a Project Folder:
mkdir my_project && cd my_project
-
Set Up a Python Virtual Environment:
python3 -m venv venv source venv/bin/activate # On Windows, use venv\Scripts\activate
-
Install Blesta SDK:
pip install blesta_sdk
-
Configure API Credentials:
Generate API credentials in Blesta's staff area and save them in a
.envfile in your project's root folder:BLESTA_API_URL=https://your-blesta-domain.com/api BLESTA_API_USER=your_api_user BLESTA_API_KEY=your_api_key
That's it. Let's roll!
๐ Usage Examples
General Command Structure
blesta-cli --model <model_name> --method <method_name> [--action GET] [--params key=value key2=value2] [--last-request]
--model: The API model to interact with (e.g.,clients,services).--method: The method to call on the specified model (e.g.,getList,get,getCustomFields).--action: The HTTP action to perform (default isGET).--params: Optional parameters to pass to the method (e.g.,key=valuepairs).--last-request: Repeats the last request made.
Clients Model (API Documentation)
-
List all active clients:
blesta-cli --model clients --method getList --params status=active --last-request
-
Get details of a specific client:
blesta-cli --model clients --method get --params client_id=1 --last-request
Services Model (API Documentation)
-
List all active services:
blesta-cli --model services --method getList --params status=active --last-request
-
Count the active services for a client:
blesta-cli --model services --method getListCount --params client_id=1 status=active
-
List all services for a client:
blesta-cli --model services --method getAllByClient --params client_id=1 status=active --last-request
๐ Project Structure
Here's an overview of the project structure:
.
โโโ LICENSE
โโโ README.md
โโโ examples
โ โโโ examples.sh
โโโ pyproject.toml
โโโ src
โ โโโ blesta_sdk
โ โโโ __init__.py
โ โโโ core
โ โ โโโ __init__.py
โ โ โโโ blesta_response.py
โ โโโ api
โ โ โโโ __init__.py
โ โ โโโ blesta_request.py
โ โโโ cli
โ โโโ __init__.py
โ โโโ blesta_cli.py
โโโ tests
โ โโโ __init__.py
โ โโโ test_blesta_sdk.py
โโโ uv.lock
- LICENSE: The license file for the project.
- README.md: The main documentation file for the project.
- examples/: Contains example scripts and usage.
- pyproject.toml: Configuration file for the project.
- src/: The source code for the Blesta SDK.
- blesta_sdk/: The main package for the SDK.
- core/: Core functionality and response handling.
- api/: API request handling.
- cli/: Command-line interface implementation.
- blesta_sdk/: The main package for the SDK.
- tests/: Unit tests for the SDK.
- uv.lock: Lock file for dependencies.
๐ค Contribution
We welcome contributions! Whether it's a feature request, bug report, or pull request, we appreciate your input.
How to Contribute
- Fork the repository.
- Create a feature branch:
git checkout -b feature/your-feature-name
- Commit your changes:
git commit -m "Add your feature description here"
- Push to your branch:
git push origin feature/your-feature-name
- Open a pull request:
- Push your branch to GitHub.
- Go to the repository on GitHub.
- Click on the "Pull requests" tab.
- Click "New pull request".
- Select your branch and the main branch.
- Add a descriptive title and detailed description.
- Click "Create pull request".
This project is licensed under the MIT License
Happy coding! ๐
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 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 blesta_sdk-0.1.5.tar.gz.
File metadata
- Download URL: blesta_sdk-0.1.5.tar.gz
- Upload date:
- Size: 19.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40a9567066c2444591a9ef6c999de29a19483e2d459df7cf4fe7113b35cad450
|
|
| MD5 |
737190e894f1390bc2e1e408cdf98be0
|
|
| BLAKE2b-256 |
d1c0563e22e75efae0062dd17895958fb0cedc700d5efae3e6e97993514e26e5
|
File details
Details for the file blesta_sdk-0.1.5-py3-none-any.whl.
File metadata
- Download URL: blesta_sdk-0.1.5-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dde0055e2632f9f0722028477c290ade73ea992564c292274f1aa528803904d6
|
|
| MD5 |
3bf4968fe9797dcae1ebaaa8389c3354
|
|
| BLAKE2b-256 |
14fe8391579f9c37624812bbf5a603e9627421a6de7b257551c2aca74a9a534c
|