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.7 or higher.

pip install nightfall

Quickstart

Make a new API Token in Nightfall and store the value as an environment variable.

import os

from nightfall import Confidence, DetectionRule, Detector, Nightfall

nightfall = Nightfall(os.getenv('NIGHTFALL_API_KEY'))

findings, _ = nightfall.scan_text(
        ["4916-6734-7572-5015 is my credit card number"],
        [DetectionRule(
            [Detector(min_confidence=Confidence.LIKELY,
                     nightfall_detector="CREDIT_CARD_NUMBER")])])
print(findings)

For more information on the details of this library, please refer to the API 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 pytest. Be sure to have NIGHTFALL_API_KEY set as an environment variable 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.

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. Commit changes and push to the main branch.
  4. Create a new release in the GitHub UI.
  5. 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-1.0.1.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

nightfall-1.0.1-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nightfall-1.0.1.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for nightfall-1.0.1.tar.gz
Algorithm Hash digest
SHA256 78e760f16b1efddbddb7f54d29b2652a904553e01cc7b278bc611ac64a1e6a4a
MD5 7d9cb0b93100445d8dd2e680dc875bcf
BLAKE2b-256 26414537219d2e73f87133c8b6218033a719f78ddb663cb32567594de12d82a5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nightfall-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 11.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for nightfall-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d18d0e9a982eda6883bb0788c3ab8720b5a4f362b0f4f7937ac7b2cbf40507d1
MD5 ca03adc0473c73fe706435ac59fd4077
BLAKE2b-256 cdf5b5a555e4274a539fc5739edae0e022596fb0c36c32bdcbb9c3f29af9bc97

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