Skip to main content

Python SDK for Nightfall

Project description

Nightfall Python SDK

This is a python SDK for working with the Nightfall API.

PyPI version

Installation

This module requires Python 3.6 or higher.

pip install nightfall

Quickstart

Make a new API Token and Detection Rule Set in Nightfall and store the values as environment variables.

from nightfall import Nightfall

nightfall = Nightfall(
    os.getenv('NIGHTFALL_TOKEN'),
    os.getenv('NIGHTFALL_CONDITION_SET')
    )

response = nightfall.scan([{'id': 'test string'}])

print(response)

For more information on the details of this library, please refer to the SDK Documentation.

Contributing

Please create an issue with a description of your problem, or open a pull request with the fix.

Development

Installing Development Dependencies

If you want to hack on this project, you should set up your local development environment with the following commands:

  1. Fork and clone this repo and open a terminal with the root of this repository in your working directory.
  2. Create and activate a virtualenv python3 -m venv venv && source venv/bin/activate
  3. Install development dependencies with pip install -r dev-requirements.txt
  4. Install an editable version of this package pip install -e .

Run Unit Tests

Unit and Integration tests can be found in the tests/ directory. You can run them with make test. Be sure to have NIGHTFALL_TOKEN and NIGHTFALL_CONDITION_SET set as environment variables before running the tests.

View Code Coverage

You can view the code coverage report by running coverage html and python3 -m http.server --directory htmlcov after running the unit tests.

SDK Documentation

The SDK is documented using the Sphinx library. You can generatre the developer documentation using make docs and preview it on localhost:8000 by running make serve-docs.

Creating a Release

Releases are automatically published to PyPI using GitHub Actions. Creating a release in GitHub will trigger a new build that will publish the latest version of this library to PyPI.

The steps to do this are:

  1. Add what changed to the CHANGELOG file
  2. Update the version in setup.py
  3. Generate documentation with make docs to make sure it's up to date
  4. Commit changes and push to the main branch.
  5. Create a new release in the GitHub UI.
  6. Observe the release action succeed and see the latest version of this library on PyPI.

License

MIT

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

nightfall-0.5.0.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

nightfall-0.5.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file nightfall-0.5.0.tar.gz.

File metadata

  • Download URL: nightfall-0.5.0.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for nightfall-0.5.0.tar.gz
Algorithm Hash digest
SHA256 1b49de0a28bd5c5fbb7188f31e15590676bf312119df664d2e3f390f8106bcfe
MD5 af194ad78d6f9c99663b9dfab35fd204
BLAKE2b-256 027e31c026908a2d3f2c67a23c8b6294c3dc6cacbdcf3052c589cb2d2043847a

See more details on using hashes here.

File details

Details for the file nightfall-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: nightfall-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for nightfall-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e3f316b85e736e10930573789e8879c79be6387c61c76010f83c17f6c6310c26
MD5 c177b1d081359be445dc83f8155f8e03
BLAKE2b-256 2f96671da361138f6486b2ba42ae1c046d354b181c93824a77a898e73e48cbe6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page