Skip to content
Permalink
Browse files
fix: adds comment with explicit hostname change (#94)
* fix: adds switching code for client_options based upon location
  • Loading branch information
telpirion committed Mar 11, 2021
1 parent dabe48e commit bb639f9470304b9c408143a3e8091a4ca8c54160
@@ -38,7 +38,12 @@ def batch_process_documents(
timeout: int = 300,
):

client = documentai.DocumentProcessorServiceClient()
# You must set the api_endpoint if you use a location other than 'us', e.g.:
opts = {}
if location == "eu":
opts = {"api_endpoint": "eu-documentai.googleapis.com"}

client = documentai.DocumentProcessorServiceClient(client_options=opts)

destination_uri = f"{gcs_output_uri}/{gcs_output_uri_prefix}/"

@@ -27,8 +27,12 @@ def process_document_sample(
):
from google.cloud import documentai_v1beta3 as documentai

# Instantiates a client
client = documentai.DocumentProcessorServiceClient()
# You must set the api_endpoint if you use a location other than 'us', e.g.:
opts = {}
if location == "eu":
opts = {"api_endpoint": "eu-documentai.googleapis.com"}

client = documentai.DocumentProcessorServiceClient(client_options=opts)

# The full resource name of the processor, e.g.:
# projects/project-id/locations/location/processor/processor-id
@@ -25,7 +25,13 @@


def quickstart(project_id: str, location: str, processor_id: str, file_path: str):
client = documentai.DocumentProcessorServiceClient()

# You must set the api_endpoint if you use a location other than 'us', e.g.:
opts = {}
if location == "eu":
opts = {"api_endpoint": "eu-documentai.googleapis.com"}

client = documentai.DocumentProcessorServiceClient(client_options=opts)

# The full resource name of the processor, e.g.:
# projects/project-id/locations/location/processor/processor-id

0 comments on commit bb639f9

Please sign in to comment.