This document describes the Python API client examples provided with GCRIPT to help developers automate document processing workflows.
The GCRIPT project includes a set of ready-to-use Python scripts that demonstrate how to interact with the API. These scripts cover the full lifecycle of a job, from health checks to result downloading.
gcript_web/content/examples/python_api_client/static/examples/python_api_client.zip| Script | Description |
|---|---|
config.py |
Central configuration file for API URL and Key. |
1_check_health.py |
Verifies connectivity to the API and validates your API Key. |
2_submit_job.py |
Demonstrates how to upload a file and submit a processing job with configuration options (including anonymization). |
3_check_status.py |
Polls the /jobs/<id> endpoint to check the progress of a specific job. |
4_download_result.py |
Downloads the final processed document once the job is complete. |
5_end_to_end.py |
A complete workflow script that chains all the above steps together. |
6_analyze_and_submit.py |
Advanced: Demonstrates how to first analyze a document structure (/analyze-sections) and then submit a job that specifically skips certain sections. |
The examples demonstrate advanced API features including:
You can protect sensitive information by specifying a list of strict terms to anonymize.
* Configuration: anonymization.protected_strings
* Example: 2_submit_job.py
* Usage:
python
options = {
"anonymization": {
"protected_strings": ["Project Alpha", "John Doe"],
"anonymize_numbers": True
}
}
You can skip specific sections of a document (e.g., appendices, prefaces) by index.
* Configuration: skip_sections (List of integers)
* Example: 6_analyze_and_submit.py
* Usage:
1. Call POST /api/analyze-sections to get the list of sections and their indices.
2. Pass the indices you want to skip in the job submission config:
python
options = {
"skip_sections": [0, 4] # Skips the first and fifth sections
}
pip install requestsconfig.py with your API Key (generated in your User Profile).python 5_end_to_end.py to see it in action.