lilt-python

API bindings for the Lilt REST API.

View the Project on GitHub lilt/lilt-python

lilt.FilesApi

All URIs are relative to https://lilt.com/2

Method HTTP request Description
add_label POST /files/labels Add Label to File
delete_file DELETE /files Delete a File
download GET /files/download Download file
get_files GET /files Retrieve a File
remove_label DELETE /files/labels Remove Label from File
upload_file POST /files Upload a File

add_label

add_label(id, name)

Add Label to File

Add a label to a File. Example CURL: curl --X --request POST 'https://lilt.com/2/files/labels?key=API_KEY&id=1' --header 'Content-Type: application/json' \\ --data-raw '{ \"name\": \"label_name\" }'

Example

The client must configure the authentication and authorization parameters

in accordance with the API server security policy.

Examples for each auth method are provided below, use the example that

satisfies your auth use case.

Configure API key authorization: ApiKeyAuth

configuration = lilt.Configuration( host = “https://lilt.com/2”, api_key = { ‘key’: ‘YOUR_API_KEY’ } )

Uncomment below to setup prefix (e.g. Bearer) for API key, if needed

configuration.api_key_prefix[‘key’] = ‘Bearer’

Configure HTTP basic authorization: BasicAuth

configuration = lilt.Configuration( username = ‘YOUR_USERNAME’, password = ‘YOUR_PASSWORD’ )

Enter a context with an instance of the API client

with lilt.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lilt.FilesApi(api_client) id = ‘id_example’ # str | A File id. name = lilt.AddFileLabelRequest() # AddFileLabelRequest |

try:
    # Add Label to File
    api_instance.add_label(id, name)
except ApiException as e:
    print("Exception when calling FilesApi->add_label: %s\n" % e) ```

The client must configure the authentication and authorization parameters

in accordance with the API server security policy.

Examples for each auth method are provided below, use the example that

satisfies your auth use case.

Configure API key authorization: ApiKeyAuth

configuration = lilt.Configuration( host = “https://lilt.com/2”, api_key = { ‘key’: ‘YOUR_API_KEY’ } )

Uncomment below to setup prefix (e.g. Bearer) for API key, if needed

configuration.api_key_prefix[‘key’] = ‘Bearer’

Configure HTTP basic authorization: BasicAuth

configuration = lilt.Configuration( username = ‘YOUR_USERNAME’, password = ‘YOUR_PASSWORD’ )

Enter a context with an instance of the API client

with lilt.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lilt.FilesApi(api_client) id = ‘id_example’ # str | A File id. name = lilt.AddFileLabelRequest() # AddFileLabelRequest |

try:
    # Add Label to File
    api_instance.add_label(id, name)
except ApiException as e:
    print("Exception when calling FilesApi->add_label: %s\n" % e) ```

Parameters

Name Type Description Notes
id str A File id.  
name AddFileLabelRequest    

Return type

void (empty response body)

Authorization

ApiKeyAuth, BasicAuth

HTTP request headers

HTTP response details

| Status code | Description | Response headers | |————-|————-|——————| 204 | A success response. | - |

[Back to top] [Back to API list] [Back to Model list] [Back to README]

delete_file

FileDeleteResponse delete_file(id)

Delete a File

Delete a File. Example CURL command: curl -X DELETE https://lilt.com/2/files?key=API_KEY&id=123

Example

The client must configure the authentication and authorization parameters

in accordance with the API server security policy.

Examples for each auth method are provided below, use the example that

satisfies your auth use case.

Configure API key authorization: ApiKeyAuth

configuration = lilt.Configuration( host = “https://lilt.com/2”, api_key = { ‘key’: ‘YOUR_API_KEY’ } )

Uncomment below to setup prefix (e.g. Bearer) for API key, if needed

configuration.api_key_prefix[‘key’] = ‘Bearer’

Configure HTTP basic authorization: BasicAuth

configuration = lilt.Configuration( username = ‘YOUR_USERNAME’, password = ‘YOUR_PASSWORD’ )

Enter a context with an instance of the API client

with lilt.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lilt.FilesApi(api_client) id = 56 # int | A unique File identifier.

try:
    # Delete a File
    api_response = api_instance.delete_file(id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling FilesApi->delete_file: %s\n" % e) ```

The client must configure the authentication and authorization parameters

in accordance with the API server security policy.

Examples for each auth method are provided below, use the example that

satisfies your auth use case.

Configure API key authorization: ApiKeyAuth

configuration = lilt.Configuration( host = “https://lilt.com/2”, api_key = { ‘key’: ‘YOUR_API_KEY’ } )

Uncomment below to setup prefix (e.g. Bearer) for API key, if needed

configuration.api_key_prefix[‘key’] = ‘Bearer’

Configure HTTP basic authorization: BasicAuth

configuration = lilt.Configuration( username = ‘YOUR_USERNAME’, password = ‘YOUR_PASSWORD’ )

Enter a context with an instance of the API client

with lilt.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lilt.FilesApi(api_client) id = 56 # int | A unique File identifier.

try:
    # Delete a File
    api_response = api_instance.delete_file(id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling FilesApi->delete_file: %s\n" % e) ```

Parameters

Name Type Description Notes
id int A unique File identifier.  

Return type

FileDeleteResponse

Authorization

ApiKeyAuth, BasicAuth

HTTP request headers

HTTP response details

| Status code | Description | Response headers | |————-|————-|——————| 204 | A status object. | - | 0 | Unexpected error | - |

[Back to top] [Back to API list] [Back to Model list] [Back to README]

download

str download(id)

Download file

Download a File. Example CURL: curl --X --request GET 'https://lilt.com/2/files/download?key=API_KEY&id=1'

Example

The client must configure the authentication and authorization parameters

in accordance with the API server security policy.

Examples for each auth method are provided below, use the example that

satisfies your auth use case.

Configure API key authorization: ApiKeyAuth

configuration = lilt.Configuration( host = “https://lilt.com/2”, api_key = { ‘key’: ‘YOUR_API_KEY’ } )

Uncomment below to setup prefix (e.g. Bearer) for API key, if needed

configuration.api_key_prefix[‘key’] = ‘Bearer’

Configure HTTP basic authorization: BasicAuth

configuration = lilt.Configuration( username = ‘YOUR_USERNAME’, password = ‘YOUR_PASSWORD’ )

Enter a context with an instance of the API client

with lilt.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lilt.FilesApi(api_client) id = ‘id_example’ # str | A File id.

try:
    # Download file
    api_response = api_instance.download(id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling FilesApi->download: %s\n" % e) ```

The client must configure the authentication and authorization parameters

in accordance with the API server security policy.

Examples for each auth method are provided below, use the example that

satisfies your auth use case.

Configure API key authorization: ApiKeyAuth

configuration = lilt.Configuration( host = “https://lilt.com/2”, api_key = { ‘key’: ‘YOUR_API_KEY’ } )

Uncomment below to setup prefix (e.g. Bearer) for API key, if needed

configuration.api_key_prefix[‘key’] = ‘Bearer’

Configure HTTP basic authorization: BasicAuth

configuration = lilt.Configuration( username = ‘YOUR_USERNAME’, password = ‘YOUR_PASSWORD’ )

Enter a context with an instance of the API client

with lilt.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lilt.FilesApi(api_client) id = ‘id_example’ # str | A File id.

try:
    # Download file
    api_response = api_instance.download(id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling FilesApi->download: %s\n" % e) ```

Parameters

Name Type Description Notes
id str A File id.  

Return type

str

Authorization

ApiKeyAuth, BasicAuth

HTTP request headers

HTTP response details

| Status code | Description | Response headers | |————-|————-|——————| 200 | A file. | - |

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_files

list[SourceFile] get_files(id=id, labels=labels)

Retrieve a File

Retrieves one or more files available to your user. Files are not associated with a project or a memory. They are unprocessed and can be used later in the project/document creation workflow step. To retrieve a specific file, specify the id request parameter. To retrieve all files, omit the id request parameter. Example CURL command: curl -X GET https://lilt.com/2/files?key=API_KEY&id=274

Example

The client must configure the authentication and authorization parameters

in accordance with the API server security policy.

Examples for each auth method are provided below, use the example that

satisfies your auth use case.

Configure API key authorization: ApiKeyAuth

configuration = lilt.Configuration( host = “https://lilt.com/2”, api_key = { ‘key’: ‘YOUR_API_KEY’ } )

Uncomment below to setup prefix (e.g. Bearer) for API key, if needed

configuration.api_key_prefix[‘key’] = ‘Bearer’

Configure HTTP basic authorization: BasicAuth

configuration = lilt.Configuration( username = ‘YOUR_USERNAME’, password = ‘YOUR_PASSWORD’ )

Enter a context with an instance of the API client

with lilt.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lilt.FilesApi(api_client) id = 56 # int | A unique File identifier. (optional) labels = [‘labels_example’] # list[str] | One or more labels. This will return the files which contain all of the given labels. (optional)

try:
    # Retrieve a File
    api_response = api_instance.get_files(id=id, labels=labels)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling FilesApi->get_files: %s\n" % e) ```

The client must configure the authentication and authorization parameters

in accordance with the API server security policy.

Examples for each auth method are provided below, use the example that

satisfies your auth use case.

Configure API key authorization: ApiKeyAuth

configuration = lilt.Configuration( host = “https://lilt.com/2”, api_key = { ‘key’: ‘YOUR_API_KEY’ } )

Uncomment below to setup prefix (e.g. Bearer) for API key, if needed

configuration.api_key_prefix[‘key’] = ‘Bearer’

Configure HTTP basic authorization: BasicAuth

configuration = lilt.Configuration( username = ‘YOUR_USERNAME’, password = ‘YOUR_PASSWORD’ )

Enter a context with an instance of the API client

with lilt.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lilt.FilesApi(api_client) id = 56 # int | A unique File identifier. (optional) labels = [‘labels_example’] # list[str] | One or more labels. This will return the files which contain all of the given labels. (optional)

try:
    # Retrieve a File
    api_response = api_instance.get_files(id=id, labels=labels)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling FilesApi->get_files: %s\n" % e) ```

Parameters

Name Type Description Notes
id int A unique File identifier. [optional]
labels list[str] One or more labels. This will return the files which contain all of the given labels. [optional]

Return type

list[SourceFile]

Authorization

ApiKeyAuth, BasicAuth

HTTP request headers

HTTP response details

| Status code | Description | Response headers | |————-|————-|——————| 200 | A list of files. | - | 403 | User does not have permission for provided file. | - | 410 | File deleted. | - | 0 | Unexpected error. | - |

[Back to top] [Back to API list] [Back to Model list] [Back to README]

remove_label

remove_label(id, name)

Remove Label from File

Remove a label from a File. Example CURL: curl --X --request DELETE 'https://lilt.com/2/files/labels?key=API_KEY&id=1&name=label_name'

Example

The client must configure the authentication and authorization parameters

in accordance with the API server security policy.

Examples for each auth method are provided below, use the example that

satisfies your auth use case.

Configure API key authorization: ApiKeyAuth

configuration = lilt.Configuration( host = “https://lilt.com/2”, api_key = { ‘key’: ‘YOUR_API_KEY’ } )

Uncomment below to setup prefix (e.g. Bearer) for API key, if needed

configuration.api_key_prefix[‘key’] = ‘Bearer’

Configure HTTP basic authorization: BasicAuth

configuration = lilt.Configuration( username = ‘YOUR_USERNAME’, password = ‘YOUR_PASSWORD’ )

Enter a context with an instance of the API client

with lilt.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lilt.FilesApi(api_client) id = ‘id_example’ # str | A File id. name = ‘name_example’ # str | A label name.

try:
    # Remove Label from File
    api_instance.remove_label(id, name)
except ApiException as e:
    print("Exception when calling FilesApi->remove_label: %s\n" % e) ```

The client must configure the authentication and authorization parameters

in accordance with the API server security policy.

Examples for each auth method are provided below, use the example that

satisfies your auth use case.

Configure API key authorization: ApiKeyAuth

configuration = lilt.Configuration( host = “https://lilt.com/2”, api_key = { ‘key’: ‘YOUR_API_KEY’ } )

Uncomment below to setup prefix (e.g. Bearer) for API key, if needed

configuration.api_key_prefix[‘key’] = ‘Bearer’

Configure HTTP basic authorization: BasicAuth

configuration = lilt.Configuration( username = ‘YOUR_USERNAME’, password = ‘YOUR_PASSWORD’ )

Enter a context with an instance of the API client

with lilt.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lilt.FilesApi(api_client) id = ‘id_example’ # str | A File id. name = ‘name_example’ # str | A label name.

try:
    # Remove Label from File
    api_instance.remove_label(id, name)
except ApiException as e:
    print("Exception when calling FilesApi->remove_label: %s\n" % e) ```

Parameters

Name Type Description Notes
id str A File id.  
name str A label name.  

Return type

void (empty response body)

Authorization

ApiKeyAuth, BasicAuth

HTTP request headers

HTTP response details

| Status code | Description | Response headers | |————-|————-|——————| 204 | A success response. | - |

[Back to top] [Back to API list] [Back to Model list] [Back to README]

upload_file

SourceFile upload_file(name, body, file_hash=file_hash, lang_id=lang_id, project_id=project_id, category=category, labels=labels)

Upload a File

Upload a File in any of the formats documented in our knowledge base. Request parameters should be passed in as query string parameters. Example CURL command: curl -X POST https://lilt.com/2/files?key=API_KEY&name=en_US.json \\ --header \"Content-Type: application/octet-stream\" \\ --data-binary @en_US.json Calls to GET /files are used to monitor the language detection results. The API response will be augmented to include detected language and confidence score. The language detection will complete asynchronously. Prior to completion, the detected_lang value will be zxx, the reserved ISO 639-2 code for "No linguistic content/not applicable". If the language can not be determined, or the detection process fails, the detected_lang field will return und, the reserved ISO 639-2 code for undetermined language, and the detected_lang_confidence score will be 0.

Example

The client must configure the authentication and authorization parameters

in accordance with the API server security policy.

Examples for each auth method are provided below, use the example that

satisfies your auth use case.

Configure API key authorization: ApiKeyAuth

configuration = lilt.Configuration( host = “https://lilt.com/2”, api_key = { ‘key’: ‘YOUR_API_KEY’ } )

Uncomment below to setup prefix (e.g. Bearer) for API key, if needed

configuration.api_key_prefix[‘key’] = ‘Bearer’

Configure HTTP basic authorization: BasicAuth

configuration = lilt.Configuration( username = ‘YOUR_USERNAME’, password = ‘YOUR_PASSWORD’ )

Enter a context with an instance of the API client

with lilt.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lilt.FilesApi(api_client) name = ‘name_example’ # str | A file name. body = ‘/path/to/file’ # file | The file contents to be uploaded. The entire POST body will be treated as the file. file_hash = ‘file_hash_example’ # str | A hash value to associate with the file. The MD5 hash of the body contents will be used by default if a value isn’t provided. (optional) lang_id = True # bool | Flag indicating whether to perform language detection on the uploaded file. Default is false. (optional) project_id = 56 # int | The project to associate the uploaded file with. (optional) category = ‘category_example’ # str | The category of the file. The options are REFERENCE, or API. The default is API. Files with the REFERENCE category will be displayed as reference material. (optional) labels = ‘labels_example’ # str | Comma-separated list of labels to add to the uploaded document. (optional)

try:
    # Upload a File
    api_response = api_instance.upload_file(name, body, file_hash=file_hash, lang_id=lang_id, project_id=project_id, category=category, labels=labels)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling FilesApi->upload_file: %s\n" % e) ```

The client must configure the authentication and authorization parameters

in accordance with the API server security policy.

Examples for each auth method are provided below, use the example that

satisfies your auth use case.

Configure API key authorization: ApiKeyAuth

configuration = lilt.Configuration( host = “https://lilt.com/2”, api_key = { ‘key’: ‘YOUR_API_KEY’ } )

Uncomment below to setup prefix (e.g. Bearer) for API key, if needed

configuration.api_key_prefix[‘key’] = ‘Bearer’

Configure HTTP basic authorization: BasicAuth

configuration = lilt.Configuration( username = ‘YOUR_USERNAME’, password = ‘YOUR_PASSWORD’ )

Enter a context with an instance of the API client

with lilt.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lilt.FilesApi(api_client) name = ‘name_example’ # str | A file name. body = ‘/path/to/file’ # file | The file contents to be uploaded. The entire POST body will be treated as the file. file_hash = ‘file_hash_example’ # str | A hash value to associate with the file. The MD5 hash of the body contents will be used by default if a value isn’t provided. (optional) lang_id = True # bool | Flag indicating whether to perform language detection on the uploaded file. Default is false. (optional) project_id = 56 # int | The project to associate the uploaded file with. (optional) category = ‘category_example’ # str | The category of the file. The options are REFERENCE, or API. The default is API. Files with the REFERENCE category will be displayed as reference material. (optional) labels = ‘labels_example’ # str | Comma-separated list of labels to add to the uploaded document. (optional)

try:
    # Upload a File
    api_response = api_instance.upload_file(name, body, file_hash=file_hash, lang_id=lang_id, project_id=project_id, category=category, labels=labels)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling FilesApi->upload_file: %s\n" % e) ```

Parameters

Name Type Description Notes
name str A file name.  
body file The file contents to be uploaded. The entire POST body will be treated as the file.  
file_hash str A hash value to associate with the file. The MD5 hash of the body contents will be used by default if a value isn't provided. [optional]
lang_id bool Flag indicating whether to perform language detection on the uploaded file. Default is false. [optional]
project_id int The project to associate the uploaded file with. [optional]
category str The category of the file. The options are `REFERENCE`, or `API`. The default is API. Files with the `REFERENCE` category will be displayed as reference material. [optional]
labels str Comma-separated list of labels to add to the uploaded document. [optional]

Return type

SourceFile

Authorization

ApiKeyAuth, BasicAuth

HTTP request headers

HTTP response details

| Status code | Description | Response headers | |————-|————-|——————| 201 | A SourceFile object. | - | 0 | Unexpected error | - |

[Back to top] [Back to API list] [Back to Model list] [Back to README]