Python SDK for Nightfall
Project description
Nightfall Python SDK
This is a python SDK for working with the Nightfall API.
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:
- Fork and clone this repo and open a terminal with the root of this repository in your working directory.
- Create and activate a virtualenv
python3 -m venv venv && source venv/bin/activate
- Install development dependencies with
pip install -r dev-requirements.txt
- 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:
- Add what changed to the CHANGELOG file
- Update the version in
setup.py
- Commit changes and push to the main branch.
- Create a new release in the GitHub UI.
- Observe the release action succeed and see the latest version of this library on PyPI.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for nightfall-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 059e3a7c9186d1a83956ad14cdf83a9f1154e25ea3821a11cd8d8e6d89e42626 |
|
MD5 | 0940f7e36eeeaa742f2192f45f5f9d9b |
|
BLAKE2b-256 | b5a1f976d410e66c49cd39f64d39b5770a9c02cea5857cd50f76d1048a10afc3 |