Skip to main content
# cloudpassage-halo-python-sdk

## Python SDK for CloudPassage Halo API

### This is a BETA (v0.99). Please don't forget to pin your work against the version you're working with, especially if it's a beta :-)

### Installation

Requirements:

* requests
* pyaml


Install from pip with ```pip install cloudpassage```. If you want to make
modifications to the SDK you can install it in editable mode by downloading
the source from this github repo, navigating to the top directory within the
archive and running ```pip install -e .``` (note the . at the end).

### Quick Start

Here's the premise: you store your session configuration information (API
credentials, proxy settings, etc) in the cloudpassage.HaloSession object.
This object gets passed into the various class methods which allow you
to interact with the CloudPassage Halo API.

Practical example:
We'll print a list of all servers in our account:

```python
import cloudpassage

api_key = MY_HALO_API_KEY
api_secret = MY_API_SECRET
session = cloudpassage.HaloSession(api_key, api_secret)
server = cloudpassage.Server(session)

list_of_servers = server.list_all()
for s in list_of_servers:
print "ID: %s Name: %s" % (s["id"], s["hostname"])

```

### Testing

#### Important locations for testing:

tests/configs: You'll find a file here called portal.yaml. Copy it to
portal.yaml.local and complete the information inside with your API key and
secret. the .gitignore settings will keep you from checking in your creds
if you put them in the .local file. This file (portal.yaml.local) is
referenced directly by all tests requiring interaction with the API.

tests/policies: These are Halo policies, used primarily for integration
tests.

tests/tests: This is where you'll find the actual tests.


#### Environmental Requirements

You'll need to have a CloudPassage Halo account available for running the
tests, as many are integration-focused. These are the things you need to have
(at the very least) to get a clean testing run:

* Servers:
* Have at least one active Linux and active Windows server.
* One deactivated server of any type.
* Policies:
* One firewall policy
* One alert profile
* One Linux CSM policy
* One Linux FIM policy
* One Windows FIM policy
* One LIDS policy
* Scans:
* CSM (Failed scan)
* FIM (active baseline and successful scan)
* One CVE exception
* Events:
* One event produced by a Windows server.
* Server Group:
* Using the default group is fine.
* Assign the policies mentioned above to the group.
* Run FIM baselines against the Linux and Windows servers.
* Kick off a CSM scan if it doesn't happen automatically


#### Running tests:

Navigate to tests/ and run ``py.test ./integration ./unit ./style``
to run the entire test suite. You can remove any of these if you
want to focus on a particular section. For instance, to run only
the unit and style tests, you would use ``py.test ./unit ./style``.

If you've got the coverage module installed,
``py.test --cov=cloudpassage ./integration ./unit ./style``
will show statement test coverage.


<!---
#CPTAGS:community-supported integration api-example
#TBICON:images/python_icon.png
-->


Metadata

Release files for cloudpassage 0.99

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cloudpassage 0.99
File Size Uploaded Provenance Actions
cloudpassage-0.99.tar.gz 18.1 kB Without provenance Details for cloudpassage-0.99.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cloudpassage 0.99
File Interpreter ABI Platform Actions
cloudpassage-0.99-py2-none-any.whl Python 2 none any Details for cloudpassage-0.99-py2-none-any.whl

Total release size: 48.4 kB

Release files / cloudpassage-0.99.tar.gz

Download URL cloudpassage-0.99.tar.gz
Size 18.1 kB
Tags Source
SHA-256 checksum
How to use checksums
225d3d0e4407fb03d82f668148794d2b14393542bcf6e3cf2707899ddb450d4b
BLAKE2b-256 checksum
How to use checksums
9c63ef77c8215a3f00fe77607fb319d8a4b9a14cc4f3f557f2c8acba985fb7ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / cloudpassage-0.99-py2-none-any.whl

Download URL cloudpassage-0.99-py2-none-any.whl
Size 30.3 kB
Tags Python 2
SHA-256 checksum
How to use checksums
e39516088a603b9a6421625bbbfc540cb55c18fc39f525b88dced49f36d69e65
BLAKE2b-256 checksum
How to use checksums
d6d0317c810e5af5b620e26d6be3a5ceedf2d3d093dc5b3e02b9bd389d80d7aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for cloudpassage 0.99

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.99 This release

2 release files No provenance

0.1.1

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page