Python driver for the TCAnnex CPRT API
Project description
tcannex
A Python driver for the TCAnnex CPRT (Cybersecurity and Privacy Reference Tool) API.
Installation
pip install tcannex
Quick Start
Set your API key as an environment variable:
export TCANNEX_API_KEY="your-api-key"
Use the client:
from tcannex import TCAnnexClient
with TCAnnexClient() as client:
# List all documents
response = client.get_documents()
for doc in response.documents:
print(f"{doc.name} (v{doc.version})")
# Get a specific document with its elements and relationships
response = client.get_document("NIST_CSF_2.0")
for element in response.elements:
print(f" {element.element_identifier}: {element.title}")
# Get a specific element
response = client.get_element("NIST_CSF_2.0", "GV")
print(response.elements[0].text)
You can also pass the API key directly:
client = TCAnnexClient(api_key="your-api-key")
API Reference
Client
TCAnnexClient(api_key=None, base_url="https://api.tcannex.com")
| Method | Description |
|---|---|
get_root() |
Read API root |
get_documents() |
List all documents |
get_document(document_identifier) |
Get a document with its elements, relationships, and relationship types |
get_element(document_identifier, element_identifier) |
Get an element with its document, relationships, and relationship types |
close() |
Close the HTTP client |
All methods return a CPRTResponse.
Models
CPRTResponse—documents,elements,relationship_types,relationshipsDocument—doc_identifier,name,version,websiteElement—doc_identifier,element_type,element_identifier,title,textRelationship—source_element_identifier,source_doc_identifier,dest_element_identifier,dest_doc_identifier,provenance_doc_identifier,relationship_identifierRelationshipType—relationship_identifier,description,value
Exceptions
TCAnnexError— Base exceptionAuthenticationError— Missing or invalid API keyAPIError— Non-2xx response (hasstatus_codeandbodyattributes)
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tcannex-0.1.0.tar.gz.
File metadata
- Download URL: tcannex-0.1.0.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b3e5347b864b1e6492ce42f43579e76279ca99ce7fed3907c94f98c12b6b2b9
|
|
| MD5 |
1ba26ca3f8772938d7d9312834cc6cb1
|
|
| BLAKE2b-256 |
513357749ade9cadfe9c92552fd55bf6a53ef0b5d12e4a64690c93a9660d3761
|
File details
Details for the file tcannex-0.1.0-py3-none-any.whl.
File metadata
- Download URL: tcannex-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0adced1eeef69c3a956afb7939be5b688d2248b3a1313caa6e8dd945dcc2c984
|
|
| MD5 |
b396198716193223fe58796830ec8c99
|
|
| BLAKE2b-256 |
56eae79acb0c2aa4b691a889f0bcb9555a31051145ddfd18b1b741968b79e96e
|