Skip to main content

Version-specific Python 3 wrapper for the Ubersmith API

Project description

Python Ubersmith

Pypi MIT licensed GitHub Release Date

A fully-featured API wrapper for the Ubersmith API

Python wrappers exist on PyPI and across GitHub for interacting with the Ubersmith API, but each of them fails to provide full compatibility.

In comes ubersmith-api...

Installation

# PyPi Installation
pip install ubersmith-api
# GitHub Installation
pip install git+'https://github.com/bnassif/ubersmith-api.git'

Overview

The ubersmith-api package ships two separate layers of usage, which offer varying levels of compatibility.

Both levels use the robust UbersmithConfig Pydantic Settings object, which exposes all settings for how to interact with the API.

Universal Client

The universal client, UbersmithClient provides a generic object for interacting with any Ubersmith version using the version 2.0 API. This object ships with just three methods bound to it:

  • UbersmithClient.request(): Method for making API calls
  • UbersmithClient.system_info(): Calls user.system_info
  • UbersmithClient.method_list(): Calls user.method_list
  • UbersmithClient.method_get(): Calls user.method_get

Example Usage

from ubersmith import *

config = UbersmithConfig(
    host='target-hostname-or-address',
    username='username-to-use',
    password='api-token-for-user',
)

api_client = UbersmithClient(config)

client_info = api_client.request(
    'client.get',
    data={
        'client_id': 1234,
        'metadata': True,
    },
    #raw=True, # Optionally return the unparsed `requests.Response` object
)

Version Specific Clients

Built atop the universal client, version-specific clients are also shipped with ubersmith-api to provide more robust API interactions.

Version-specific clients extend the UbersmithClient object by binding API sections to it, with each section having functions that correspond to API methods.

Example Usage

from ubersmith.versions import *

config = UbersmithConfig(
    host='target-hostname-or-address',
    username='username-to-use',
    password='api-token-for-user',
)

api_client = get_client(version='5.1.3-rc2', config=config)

client_info = api_client.client.get(
  client_id=1234,
  metadata=True,
)

[!TIP] Version specific clients are built using JSON schema files generated with API calls against an Ubersmith instance running the target version.

If your version is not supported, you are encouraged to generate a schema and submit its schema in a PR.
See the schema docs for details on how to get started with generating and using schemas.

[!IMPORTANT] Some API methods shipped by Ubersmith have unsafe parameter names.
In these cases, the parameters and sometimes methods are omitted from generation to prevent unwanted errors.

License

MIT - Feel free to use, extend, and contribute.

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

ubersmith_api-1.1.0.tar.gz (188.3 kB view details)

Uploaded Source

Built Distribution

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

ubersmith_api-1.1.0-py3-none-any.whl (201.7 kB view details)

Uploaded Python 3

File details

Details for the file ubersmith_api-1.1.0.tar.gz.

File metadata

  • Download URL: ubersmith_api-1.1.0.tar.gz
  • Upload date:
  • Size: 188.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ubersmith_api-1.1.0.tar.gz
Algorithm Hash digest
SHA256 8bd2fdd0a79c94485992cdf3d537aaacd34d68d1d870f8818e1362d42c908f00
MD5 0afdbce2656753f0191a3a9e97a4c39e
BLAKE2b-256 1b432a31b83b950e3021dd8e9bdc2751a24106e602541b2596036f78dfdff06a

See more details on using hashes here.

Provenance

The following attestation bundles were made for ubersmith_api-1.1.0.tar.gz:

Publisher: release.yml on bnassif/ubersmith-api

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

File details

Details for the file ubersmith_api-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: ubersmith_api-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 201.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ubersmith_api-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c9cfac99377d9841b4fd0940fe40a3034ea210f58bd26c79b219038cc5fe3ed0
MD5 e2e056b76bc4b485965cbd885451c10a
BLAKE2b-256 f3c9f9aea5ad541a542cebb4176cf0a04f17e401c6e2633a3dd87984251b13b9

See more details on using hashes here.

Provenance

The following attestation bundles were made for ubersmith_api-1.1.0-py3-none-any.whl:

Publisher: release.yml on bnassif/ubersmith-api

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