https://github.com/paloaltonetworks/cortex-xpanse-python-sdk
Python SDK for Cortex™ Xpanse
https://github.com/paloaltonetworks/cortex-xpanse-python-sdk
api cortex python3 sdk sdk-python xpanse
Last synced: 5 months ago
JSON representation
Python SDK for Cortex™ Xpanse
- Host: GitHub
- URL: https://github.com/paloaltonetworks/cortex-xpanse-python-sdk
- Owner: PaloAltoNetworks
- License: isc
- Created: 2021-08-11T14:57:11.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-08-08T19:21:56.000Z (about 2 years ago)
- Last Synced: 2024-10-13T23:47:33.349Z (12 months ago)
- Topics: api, cortex, python3, sdk, sdk-python, xpanse
- Language: Python
- Homepage: https://cortex-xpanse-python-sdk.readthedocs.io/en/latest/xpanse.html
- Size: 2.64 MB
- Stars: 4
- Watchers: 7
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
Cortex Xpanse Python SDK
========================Overview
--------This library is intended to be an interface to the
Cortex Xpanse Public API.Install
-------
```python
pip install xpanse
```Requirements
------------`Python 3.7+`
Usage
-----
Cortex Xpanse Public API Documentation```python
# Import client
from xpanse.client import XpanseClient# Initialize client
client = XpanseClient()# Get assets iterator object and dump to a list
assets = client.assets.list().dump()
```You can view more example code in the examples directory.
Configuration
-------------
A valid `API Key`, `API Key ID`, and `Fully Qualified Domain Name (FQDN)` are required for use.Reference the docs for more information with Getting Started.
#### RECOMMENDED
***********
You can supply them as environment variables.```shell script
export CORTEX_FQDN=
export CORTEX_API_KEY=
export CORTEX_API_KEY_ID=
```
#### NOT RECOMMENDED
***************
The following parameters can be set inline using the `XpanseClient` constructor._This is not recommended, as it easily exposes sensitive credentials in your source code._
```python
# Import client
from xpanse.client import XpanseClient# Initialize client - THIS IS NOT RECOMMENDED, SET ENVIRONMENT VARIABLES INSTEAD
client = XpanseClient(url="https://my-company.crtx.us.paloaltonetworks.com",
api_key="xxxxxxxxxxxxxxxApiKeyxxxxxxxxxxxxxxx",
api_key_id=1)
```Logging
-------
Logging is handled through the python logging package. To enable different levels of verbosity in your scripts you can do the following:```python
import logging# Set the logging level
logging.basicConfig(level=logging.DEBUG)
```You can read more at .