Python library is an interface to the Xpanse Expander API.
Project description
Overview
This library is intended to be an interface to the Xpanse Expander API.
Install
pip install xpanse
Requirements
Python 3.6+
Usage
# Import client
from xpanse.client import ExClient
# initialize client
client = ExClient()
# get ip_range iterator object and dump to a list
ranges = client.assets.ip_range.list().dump()
You can view more example code in the examples directory.
Configuration
A valid Client ID and Secret is required for use. This is recommended over using a JWT, as they have limited lifespans. While a bearer token is supported in this version, this auth flow is being deprecated. Therefore, it is highly recommended to use Client Credentials.
RECOMMENDED
You can supply them as environment variables using the variable names XPANSE_CLIENT_ID AND XPANSE_CLIENT_SECRET.
export XPANSE_CLIENT_ID=<Client ID>
export XPANSE_CLIENT_SECRET=<Client Secret>
NOT RECOMMENDED
To use a short lived JWT, you can supply the JWT as an environmental variable using the name XPANSE_JWT_TOKEN
export XPANSE_JWT_TOKEN=<JWT>
[Deprecated] A valid Bearer token can be supplied as an environment variable
To supply a valid bearer token as an environment variable, you can use the variable names XPANSE_BEARER_TOKEN.
export XPANSE_BEARER_TOKEN=<Bearer Token>
Logging
Logging is handled through the python logging package. To enable different levels of verbosity in your scripts you can do the following:
import logging
logging.basicConfig(level=logging.DEBUG)
You can read more at https://docs.python.org/3/library/logging.html.
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
Hashes for xpanse-1.1.1.post2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2132466be736a00c1c46e4afd1e00076985cbff621ebe5ac49eb3304ea994cf6 |
|
MD5 | b2b2337ee40fa02e45f77fbfa34203be |
|
BLAKE2b-256 | 7ef900bb08fa03188bd370a0a299afd4bf46584dd9d02216491ade137b079c8f |