Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

fix: added if statement to filter out dir blob files #63

Merged
merged 5 commits into from Dec 2, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion samples/snippets/batch_process_documents_sample_v1beta3.py
Expand Up @@ -78,9 +78,12 @@ def batch_process_documents(

for i, blob in enumerate(blob_list):
# Download the contents of this blob as a bytes object.
if ".json" not in blob.name:
munkhuushmgl marked this conversation as resolved.
Show resolved Hide resolved
return
# Only parses JSON files
blob_as_bytes = blob.download_as_bytes()
document = documentai.types.Document.from_json(blob_as_bytes)

document = documentai.types.Document.from_json(blob_as_bytes)
print(f"Fetched file {i + 1}")

# For a full list of Document object attributes, please reference this page: https://googleapis.dev/python/documentai/latest/_modules/google/cloud/documentai_v1beta3/types/document.html#Document
Expand Down