Unmand Python Library
The Unmand Python library provides convenient access to the Unmand APIs from applications written in the Python language.
For more help, see our docs.
Requirements
Python 3+
Installation
Install the package with:
pip install unmand
Example Usage
from unmand import Extraction, ExfilAPI
token = 'TOP-SECRET-EXAMPLE-TOKEN'
document_path = 'Sample.pdf'
exfil = ExfilAPI(token)
with open(document_path, 'rb') as file_data:
extraction = exfil.queue(file_data)
print(extraction)
if extraction.status != "FAILED":
exfil.poll(extraction=extraction)
if extraction.status == 'FINISHED':
print(extraction.result)
ExfilAPI and Extraction
The main class is ExfilAPI. Instantiate this with your token argument. Use the optional argument test to direct your queries to the test API instead of the production API. For example:
exfil_test = ExfilAPI(token, test=True) # This aims at the test API
exfil = ExfilAPI(token) # This aims at the production API
Submit a extraction by attaching the binary file data from your system to the queue method of ExfilAPI. This will return an instance of the Extraction class.
extraction = exfil.queue(file_data)
At any time, you can get the status of the extraction:
print(extraction) # or
print(extraction.status)
Once a extraction is queued, call the poll method of the ExfilAPI class to be updated when the extraction is finished. Use the optional argument suppress_output to stop updates printing to screen.
exfil.poll(extraction=extraction) # or
exfil.poll(extraction=extraction, suppress_output=True)
Once finished, the results of the extraction are saved as a dictionary under the result attribute.
print(extraction.result)
Swarm Tasks
There is a SwarmAPI class so that swarm tasks can be uploaded for display in the UI. An example usage is shown below. Be careful, the token for a Swarm project will be different.
swarm = SwarmAPI(token, test=True)
start_time = datetime.utcnow()
finish_time = datetime.utcnow()
response_details = {'Some data': 1, 'Some other data': 2, "an array": [1,2,3,4]}
status = 'SUCCESS' # or 'FAILURE'
task = Task('UniqueTestId', start_time, finish_time , status, 'PROD', 'Short Response', response_details , "First Identifier", "Second Identifier", "Third Identifier")
swarm.upload_swarm_task(task)
Metadata
Release files for unmand 2.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| unmand-2.3.0.tar.gz | 20.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| unmand-2.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 38.6 kB
Release files / unmand-2.3.0.tar.gz
| Download URL | unmand-2.3.0.tar.gz |
|---|---|
| Size | 20.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
48163378c8c47f3518a7ae5e91a4dfb1611ebb132232e734a6b52123eeb56b69
|
|
BLAKE2b-256 checksum How to use checksums |
5f920b1c6f4b7ba40321ef9960f8769513b1718d65ecb53bc316b3e911f8cd6c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Release files / unmand-2.3.0-py3-none-any.whl
| Download URL | unmand-2.3.0-py3-none-any.whl |
|---|---|
| Size | 18.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dc6f4158ef91d2b91ad66bbc382ddcb76146e8d68bfd3dfa92f39977be56c348
|
|
BLAKE2b-256 checksum How to use checksums |
0eea6072e1c10d507ce24f4ea8031b791b99b57473747fe3a2af62c637a67310
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Security for unmand 2.3.0
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.