Python library is an interface to the Xpanse Expander API.
This library is intended to be an interface to the Xpanse Expander API.
pip install xpanse
# 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.
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.
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>
To use a short lived JWT, you can supply the JWT as an environmental variable using the name XPANSE_JWT_TOKEN
[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 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.
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.