Skip to main content

Python SDK for interacting with the Whaller API

Project description

Whaller Client SDK in Python

📌 Introduction

This project is a Python SDK for interacting with the Whaller API.

This library is in the early stages of implementation and contains only a few endpoints, but you can easily extend it by following the do. We encourage you to work with the Whaller teams on extending it.

📦 Installation

pip install whaller-client

🚀 Try the examples

1️⃣ Set environment variables

Before running examples scripts, you must create a env.py file with the following content as indicated in the env.orig.py file at the root of the examples folder:

BASE_URL = "https://my.whaller.com"
CLIENT_ID = "your_client_id"
CLIENT_TOKEN = "your_client_token"
LOGIN = "your_email"
PASSWORD = "your_password"

[!IMPORTANT] If you do not have client_id and client_token, please contact contact@whaller.com. Please note that there is a charge for obtaining these credentials.

2️⃣ Run an authentication example

An authentication example script is available in examples/. To run it:

cd examples/
python example_auth.py

If authentication is successful, you will see:

Authentication successful.

3️⃣ Use the SDK in your project

Minimal usage example:

from whaller_client.client import Client
from whaller_client.endpoints.persons import Persons

# Initialize the client
client = Client(BASE_URL, CLIENT_ID, CLIENT_TOKEN)
client.set_credentials(LOGIN, PASSWORD)
client.authenticate()

# Example usage of endpoints
persons = Persons(client)
print(persons.get_notifications(LOGIN))

👨‍💻 For Developers

Setting up the development environment

If you want to contribute to this project or modify it for your own needs, follow these steps to set up a development environment:

  1. Clone the repository
git clone https://github.com/whallerfr/client-python.git
cd client-python
  1. Create a virtual environment (recommended)
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install the package in development mode
pip install -e .
  1. Install development dependencies
pip install pytest pytest-cov

Running the tests

The project includes a comprehensive test suite with 100% code coverage. To run the tests:

python -m pytest

To run the tests with coverage report:

python -m pytest --cov=whaller_client

To generate an HTML coverage report:

python -m pytest --cov=whaller_client --cov-report=html

The HTML report will be available in the htmlcov directory. Open htmlcov/index.html in your browser to view it.

Project structure

whaller_client/           # Main package
├── __init__.py           # Package initialization
├── api.py                # API client implementation
├── auth.py               # Authentication handling
├── client.py             # Main client class
├── exceptions.py         # Custom exceptions
├── logger.py             # Logging utilities
└── endpoints/            # API endpoints
    ├── __init__.py
    ├── box.py            # Box resource endpoints
    ├── invitation.py     # Invitation endpoints
    ├── me.py             # User-related endpoints
    └── upload.py         # File upload endpoints

tests/                    # Test suite
├── unit/                 # Unit tests
│   └── whaller_client/   # Tests for main package
│       ├── endpoints/    # Tests for endpoints
│       └── ...           # Tests for other modules

📄 License

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

📫 Support

For any questions or suggestions, open an issue on GitHub.

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

whaller_client-0.1.2.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

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

whaller_client-0.1.2-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file whaller_client-0.1.2.tar.gz.

File metadata

  • Download URL: whaller_client-0.1.2.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for whaller_client-0.1.2.tar.gz
Algorithm Hash digest
SHA256 1f0817d064f10b23db2a256f9e6f833909151bd09e7fb03598e9fdc0bf728bc0
MD5 e657c2d2f54485c63564a12b435189fc
BLAKE2b-256 81a2c19b7813863f113cb40ef8f76ab1646beb0e58db20298d8c62906d36a0ef

See more details on using hashes here.

Provenance

The following attestation bundles were made for whaller_client-0.1.2.tar.gz:

Publisher: python-publish.yml on whallerfr/client-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file whaller_client-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: whaller_client-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for whaller_client-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9cd5eb14cd8d4293840a3a5529b34b1a395011b9dafe48e9d2453ad411b66126
MD5 bd0ef6d7529719c9c951789da2e86cca
BLAKE2b-256 ccccef16db1348345df1db55da12816b1a1b7c40208b3530995b99202f6c045d

See more details on using hashes here.

Provenance

The following attestation bundles were made for whaller_client-0.1.2-py3-none-any.whl:

Publisher: python-publish.yml on whallerfr/client-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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