Skip to main content

A Python SDK for interacting with Blesta API

Project description

Blesta Python SDK

The Blesta Python SDK provides an easy-to-use API and CLI interface for interacting with Blesta's REST API.

🚀 Quick and Easy Setup

  1. Create a Project Folder:

    mkdir my_project && cd my_project
    
  2. Set Up a Python Virtual Environment:

    python3 -m venv venv
    source venv/bin/activate  # On Windows, use venv\Scripts\activate
    
  3. Install Blesta SDK:

    pip install blesta_cli
    
  4. Configure API Credentials:

    Admins can generate API credentials in Blesta's staff area. Save these values in a .env file located in your project's root folder. The .env file should look like this:

    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 is GET).
  • --params: Optional parameters to pass to the method (e.g., key=value pairs).
  • --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
    

🤝 Contribution

We welcome contributions! Whether it's a feature request, bug report, or pull request, we appreciate your input.

How to Contribute

  1. Fork the repository.
  2. Create a feature branch:
    git checkout -b feature/your-feature-name
    
  3. Commit your changes:
    git commit -m "Add your feature description here"
    
  4. Push to your branch:
    git push origin feature/your-feature-name
    
  5. Open a pull request.

This project is licensed under the MIT License

Happy coding! 🎉

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

blesta_sdk-0.1.tar.gz (6.1 kB view details)

Uploaded Source

Built Distributions

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

blesta_sdk-0.1.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

blesta_sdk-0.1-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file blesta_sdk-0.1.tar.gz.

File metadata

  • Download URL: blesta_sdk-0.1.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.1

File hashes

Hashes for blesta_sdk-0.1.tar.gz
Algorithm Hash digest
SHA256 2b2a6286900a97d232adece3e366ee813d9add545073ef679baac16c0a851847
MD5 7ca3f7fd468cfdda68f07ba7ad878c05
BLAKE2b-256 899b5e11be75611027de29455908f3ec1581d8c281fd40ac99abdcda6e454fcf

See more details on using hashes here.

File details

Details for the file blesta_sdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: blesta_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.1

File hashes

Hashes for blesta_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 572e39d307282399f85adabc0f0b5c4d1148860b7ab5c5ce02512012ecc3ce4c
MD5 0685143f0991e1580f4e07a715fe2d4b
BLAKE2b-256 00e45c1a59b2b2614946ee21c2efddef4f0252911b1e37a7bbfe915922d7afa3

See more details on using hashes here.

File details

Details for the file blesta_sdk-0.1-py3-none-any.whl.

File metadata

  • Download URL: blesta_sdk-0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.1

File hashes

Hashes for blesta_sdk-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4df0cee0265c8402282b5ad5f2d7e1c168af22ae4064ff525324f59e882b7d14
MD5 f04b719afc7aa9c3a8c9ace20ca3c22c
BLAKE2b-256 050411eaa3e3b4a49c9f186da80051173fd31314e07aca1acc942d798a37a5b8

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