credentials.json
key file or its contents in JSON format.
Create a service account.
Create credentials for a service account.
To ensure maximum compatibility across Unstructured service offerings, you should give the service account key information to Unstructured as
a single-line string that contains the contents of the downloaded service account key file (and not the service account key file itself).
To print this single-line string without line breaks, suitable for copying, you can run one of the following commands from your Terminal or Command Prompt.
In this command, replace <path-to-downloaded-key-file>
with the path to the credentials.json
key file that you downloaded by following the preceding instructions.
{folder_id}
: https://drive.google.com/drive/folders/{folder-id}
.
permissions_data
field, which is within the
data_source
field under the element’s metadata
field. This information lists the users or groups, if any, that have
permissions to read, update, or delete the element’s associated source document.
The following example shows what the output looks like. Ellipses indicate content that has been omitted from this example for brevity.
GOOGLE_DRIVE_FOLDER_ID
- The folder or drive ID, represented by --drive-id
(CLI) or drive_id
(Python).
GCP_SERVICE_ACCOUNT_KEY_FILEPATH
- The path to the credentials.json
key file, represented by --service-account-key-path
(CLI) or service_account_key_path
(Python).GCP_SERVICE_ACCOUNT_KEY_STRING
- The contents of the credentials.json
key file as a string, represented by --service-account-key
(CLI) or service_account_key
(Python).--extensions
with a comma-separated list (CLI) or extensions
with an array of strings (Python) to process files with only those extensions,
do not include the leading dot in the file extensions. For example, use pdf
or docx
instead of .pdf
or .docx
.--partition-by-api
option (CLI) or partition_by_api
(Python) parameter to specify where files are processed:
--partition-by-api
(CLI) or partition_by_api
(Python), or explicitly specify partition_by_api=False
(Python).
Local file processing does not use an Unstructured API key or API URL, so you can also omit the following, if they appear:
--api-key $UNSTRUCTURED_API_KEY
(CLI) or api_key=os.getenv("UNSTRUCTURED_API_KEY")
(Python)--partition-endpoint $UNSTRUCTURED_API_URL
(CLI) or partition_endpoint=os.getenv("UNSTRUCTURED_API_URL")
(Python)UNSTRUCTURED_API_KEY
and UNSTRUCTURED_API_URL
--partition-by-api
(CLI) or partition_by_api=True
(Python).
Unstructured also requires an Unstructured API key and API URL, by adding the following:
--api-key $UNSTRUCTURED_API_KEY
(CLI) or api_key=os.getenv("UNSTRUCTURED_API_KEY")
(Python)--partition-endpoint $UNSTRUCTURED_API_URL
(CLI) or partition_endpoint=os.getenv("UNSTRUCTURED_API_URL")
(Python)UNSTRUCTURED_API_KEY
and UNSTRUCTURED_API_URL
, representing your API key and API URL, respectively.https://api.unstructuredapp.io/general/v0/general
, which is the API URL for the Unstructured Partition Endpoint. However, you should always use the URL that was provided to you when your Unstructured account was created. If you do not have this URL, contact Unstructured Sales at sales@unstructured.io.If you do not have an API key, get one now.If the Unstructured API is self-hosted, the process
for generating Unstructured API keys, and the Unstructured API URL that you use, are different.
For details, contact Unstructured Sales at
sales@unstructured.io.credentials.json
file into a string, you could use a Python script such as the following.
This script takes the local path to the key file as input and outputs the key file’s contents as a string.