Package: scribemi
Scribe Private Documents (MI) SDKA Python library designed to facilitate accessing Scribe's Private Documents (MI) API.This library requires a version of Python 3 that supports typings.InstallationpipinstallScribeMiUsageConstruct clientThe constructor expects an environment object:env = {
  API_URL: 'API_URL',
  IDENTITY_POOL_ID: 'IDENTITY_POOL_ID',
  USER_POOL_ID: 'USER_POOL_ID',
  CLIENT_ID: 'CLIENT_ID',
  REGION: 'REGION',
};TheAPI_URLis"mi.scribelabs.ai/v1".TheREGIONis"eu-west-2".Contact Scribe to obtain other details required for authentication.fromScribeMiimportMIclient=MI({'API_URL':'mi.scribelabs.ai/v1','REGION':'eu-west-2','IDENTITY_POOL_ID':'Contact Scribe for authentication details','USER_POOL_ID':'Contact Scribe for authentication details','CLIENT_ID':'Contact Scribe for authentication details',})AuthenticateAuthentication is handled byScribe's Auth library, without the need for you to call that library directly.# Authenticate with username / passwordclient.authenticate({'username':'myUsername','password':'myPassword'})# OR with refresh tokenclient.authenticate({'refresh_token':'myRefreshToken'})The MI client will try to automatically re-authenticate with your refresh token, if you try to make an API call after credentials have expired.Submit a document for processingjobid=client.submit_task('path/to/file.pdf',{'filetype':'pdf','filename':'example-co-2023-q1.pdf','companyname':'Example Co Ltd'})Thefiletypeparameter is required: it should match the file's extension / MIME type.Other parameters are optional:filenameis recommended: it should be the name of the uploaded file. It appears in API responses and the web UI.companynamecan optionally be included for company Financials data: it should be the legal name of the company this document describes, so that documents relating to the same company can be collated.The returnedjobidcan be used to find information about the task status viagetTask, or via the web UI.View tasksFetch details of an individual task:task=client.get_task(jobid)print(task.status)Or list all tasks:tasks=client.list_tasks()Export output modelsAfter documents have been processed by Scribe, the task status (which can be seen viaget_task/list_tasks) is"SUCCESS". At this point, you can export the model:task=client.get_task(jobid)# Use fetchModelmodel=client.fetch_model(task)# Alternatively, fetch the model directly from its URLreturntask.modelUrlIn either case, note that the model is accessed via a pre-signed URL, which is only valid for a limited time after callingget_task/list_tasks.Collate fund dataWhen using Scribe to process fund data, multiple models can be consolidated for export in a single file:tasks=client.list_tasks()tasks_to_collate=[taskfortaskintasksiftask['originalFilename'].startswith('Fund_1')]collated_model=client.consolidate_tasks(tasks_to_collate)Delete tasks / cancel processingtask=client.get_task(jobid)client.delete_task(task)Deletion is irreversible.After a successful deletion, the file, any output model, and any other file derived from the input are deleted permanently from Scribe's servers.See alsoDocumentation for the underlying REST API may also be useful, although we recommend accessing the API via this library or our Node SDK.REST API documentationNode SDK