kodexa.platform
Integration with the Kodexa Platform for processing, storing, and sharing of documents and data.
Submodules
Package Contents
Classes
A Session on the Kodexa platform for leveraging pipelines and services |
|
Allow you to interact with a pipeline that has been deployed to an instance of Kodexa Platform |
|
Allows you to interact with a step that has been deployed in the Kodexa platform |
|
The KodexaPlatform object allows you to work with an instance of the Kodexa platform, allow you to list, view and deploy |
|
- class kodexa.platform.RemoteSession(session_type, slug)
A Session on the Kodexa platform for leveraging pipelines and services
- get_action_metadata(ref)
- Parameters
ref –
Returns:
- start()
- execution_action(document, options, attach_source, context)
- wait_for_execution(execution)
- get_output_document(execution)
Get the output document from a given execution
- Parameters
execution – the execution holding the document
- Returns
the output document (or None if there isn’t one)
- class kodexa.platform.RemotePipeline(slug, connector, version=None, attach_source=True, parameters=None, auth=None)
Allow you to interact with a pipeline that has been deployed to an instance of Kodexa Platform
- run()
- static from_url(slug: str, url, headers=None, *args, **kwargs) RemotePipeline
Build a new pipeline with the input being a document created from the given URL
- Parameters
slug – The slug for the remote pipeline
url – The URL ie. https://www.google.com
headers – A dictionary of headers (Default value = None)
slug – str:
*args –
**kwargs –
- Returns
A new instance of a remote pipeline
- static from_file(slug: str, file_path: str, unpack: bool = False, *args, **kwargs) RemotePipeline
Create a new pipeline using a file path as a source
- Parameters
slug – The slug for the remote pipeline
file_path – The path to the file
unpack – Unpack the file as a KDXA
slug – str:
file_path – str:
unpack – bool: (Default value = False)
*args –
**kwargs –
- Returns
A new pipeline
- Return type
- static from_text(slug: str, text: str, *args, **kwargs) RemotePipeline
Build a new pipeline and provide text as the basic to create a document
- Parameters
slug – The slug for the remote pipeline
text – Text to use to create document
slug – str:
text – str:
*args –
**kwargs –
- Returns
A new pipeline
- Return type
- static from_folder(slug: str, folder_path: str, filename_filter: str = '*', recursive: bool = False, unpack: bool = False, relative: bool = False, caller_path: str = get_caller_dir()) RemotePipeline
Create a pipeline that will run against a set of local files from a folder
- Parameters
slug – The slug for the remote pipeline
folder_path – The folder path
filename_filter – The filter for filename (i.e. *.pdf)
recursive – Should we look recursively in sub-directories (default False)
relative – Is the folder path relative to the caller (default False)
caller_path – The caller path (defaults to trying to work this out from the stack)
unpack – Unpack the file as a KDXA document
slug – str:
folder_path – str:
filename_filter – str: (Default value = “*”)
recursive – bool: (Default value = False)
unpack – bool: (Default value = False)
relative – bool: (Default value = False)
caller_path – str: (Default value = get_caller_dir())
- Returns
A new pipeline
- Return type
- class kodexa.platform.RemoteStep(ref, step_type='ACTION', attach_source=False, options=None)
Allows you to interact with a step that has been deployed in the Kodexa platform
- to_dict()
- get_name()
- process(document, context)
- to_configuration()
Returns a dictionary representing the configuration information for the step
- Returns
dictionary representing the configuration of the step
Args:
Returns:
- class kodexa.platform.KodexaPlatform
The KodexaPlatform object allows you to work with an instance of the Kodexa platform, allow you to list, view and deploy components
Note it also can be used to get your access token and Kodexa platform URL using:
A user config file if available
Environment variables (KODEXA_ACCESS_TOKEN and KODEXA_URL)
- static get_client()
- static get_access_token() str
Returns the access token
>>> access_token = KodexaPlatform.get_access_token()
Returns: The access token if it is defined in the user config store, or as an environment variable
- static get_url() str
Returns the URL to use to access a Kodexa Platform
The URL should be in the form https://my-company.kodexa.ai
>>> access_token = KodexaPlatform.get_url()
Returns: The URL if it is defined in the user config store, or as an environment variable
- static set_access_token(access_token: str)
Set to override the access token to use, not that this does not impact your user config stored value
- Parameters
access_token – str: The new access token
Returns: None
- static set_url(url: str)
Set to override the URL to use, not that this does not impact your user config stored value
- Parameters
url – str: The new URL
Returns: None
- static get_access_token_details() addict.Dict
Pull the access token details (including a list of the available organizations)
Returns: Dict: details of the access token
- classmethod login(kodexa_url, username, password)
- classmethod get_server_info()
- classmethod get_tempdir()
- class kodexa.platform.KodexaClient(url=None, access_token=None)
- static login(url, email, password)
- property me
- property platform kodexa.model.objects.PlatformOverview
- reindex()
- __build_object(ref, object_type_metadata)
- get_platform()
- get(url, params=None) requests.Response
- post(url, body=None, data=None, files=None, params=None) requests.Response
- put(url, body=None, data=None, files=None, params=None) requests.Response
- delete(url, params=None) requests.Response
- get_url(url)
- export_project(project: ProjectEndpoint, export_path: str)
- import_project(organization: OrganizationEndpoint, import_path: str)
- deserialize(component_dict: dict, component_type: Optional[str] = None) ComponentInstanceEndpoint
- get_project(project_id) ProjectEndpoint
- get_object_type(object_type, organization: Optional[OrganizationEndpoint] = None) ClientEndpoint