Skip to main content

Library - Python

The Python library covers all Contextal Platform's API calls, and can be used to integrate the platform with other solutions that support this kind of interface. It's part of the contextal package and is distributed under the MIT License.

Installation

The library is provided by the contextal package:

pip install contextal

Usage

Here's an example of how to use the library to upload a file and obtain the results from scenarios (if any):

from contextal import Config, Platform
from time import sleep

config = Config()
config.url = "http://contextal.my_company.lan"
#config.token = "my_token"
platform = Platform(config)
file = open("my_sample", "rb")
work = platform.submit_work(file)
sleep(1)
actions = platform.get_actions(work["work_id"])
print(actions)

Documentation

Please refer to the package documentation for details. As part of the package, we distribute two command line tools: ctx and ctx-scan, which are good examples on how to use the library.