Skip to main content

A simple Python3 client for interacting with the Bleemeo API.

Project description

Bleemeo Python Python 3.8 at least GitHub License

Python library for interacting with the Bleemeo API

Requirements

  • Python3.8 or later
  • An account on Bleemeo

Installation

Take a look at venv. This tool provides isolated Python environments, which are more practical than installing packages system-wide.

After you’ve created and activated a virtual environment, run the command:

python -m pip install --upgrade bleemeo

Documentation

The Python library is documented using docstring in the source code.

Some examples of library usage can be found in examples.

Basic usage

Listing the first 10 agents of your account:

from bleemeo import Client, Resource, APIError


def list_agents():
    with Client(load_from_env=True) as client:
        try:
            resp_page = client.get_page(Resource.AGENT, page=1, page_size=10,
                                        params={"active": True, "fields": "id,fqdn,display_name"})
            for agent in resp_page.json()["results"]:
                print(f"* Agent {agent['display_name']} (fqdn = {agent['fqdn']}, id = {agent['id']})")
        except APIError as e:
            print(f"API error: {e}:\n{e.response.text}")


if __name__ == '__main__':
    list_agents()

Save this file as list_agents.py.

Run it with:

BLEEMEO_USER=user-email@domain.com BLEEMEO_PASSWORD=password python3 list_agents.py

More examples can be found in examples

To run an example from a clone of this repository, run the following:

BLEEMEO_USER=user-email@domain.com BLEEMEO_PASSWORD=password python3 examples/list_metrics.py

Environment

At least the following options should be configured (as environment variables or with options):

  • Credentials OR initial refresh token
  • All other configuration options are optional and could be omitted

Ways to provide those options are referenced in the Configuration section.

Configuration

For environment variables to be taken into account, the parameter load_from_env of the Client constructor must be set to True.

Property Constructor parameter(s) Env variable(s) Default values
Credentials username & password BLEEMEO_USER & BLEEMEO_PASSWORD None. This option is required (unless initial refresh token is used)
Bleemeo account header account_id BLEEMEO_ACCOUNT_ID The first account associated with used credentials.
OAuth client ID/secret oauth_client_id & oauth_client_secret BLEEMEO_OAUTH_CLIENT_ID & BLEEMEO_OAUTH_CLIENT_SECRET The default SDK OAuth client ID
API URL api_url BLEEMEO_API_URL https://api.bleemeo.com
Initial refresh token oauth_initial_refresh_token BLEEMEO_OAUTH_INITIAL_REFRESH_TOKEN None. This is an alternative to username & password credentials.
Custom headers custom_headers - {"User-Agent": "Bleemeo Python Client"}
Throttle max auto retry delay throttle_max_auto_retry_delay - 1 minute.

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

bleemeo-0.9.0.tar.gz (73.6 kB view details)

Uploaded Source

Built Distribution

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

bleemeo-0.9.0-py3-none-any.whl (17.7 kB view details)

Uploaded Python 3

File details

Details for the file bleemeo-0.9.0.tar.gz.

File metadata

  • Download URL: bleemeo-0.9.0.tar.gz
  • Upload date:
  • Size: 73.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.18 {"installer":{"name":"uv","version":"0.11.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for bleemeo-0.9.0.tar.gz
Algorithm Hash digest
SHA256 45d7196a581242def854b0bcbe7069c6d512e9c3fe0ac0af38d3f4314f6fe964
MD5 8cee1631bff71722ec3320d9a8d35bfd
BLAKE2b-256 b85ba668ec7d73d061b51d9490d821566061702a30abd5fbb36498157f280925

See more details on using hashes here.

File details

Details for the file bleemeo-0.9.0-py3-none-any.whl.

File metadata

  • Download URL: bleemeo-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 17.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.18 {"installer":{"name":"uv","version":"0.11.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for bleemeo-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 056e36aacac1d0059d41aee26df87dca8d8726a4e557557a461f57166592f8a5
MD5 3337f06aced86188924e23827494555d
BLAKE2b-256 7bd3b35dc484751400c336e8592551dd815bb469bbd7c3dc6a7a24691c8a8dc9

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