Skip to content
Browse files
fix: added if statement to filter out dir blob files (#63)
Fixes #62  🦕

Current version of sample doesnt check if blob is directory or .json file. Then, it  downloads as bytes and tries to parse json from the dir blob file which will cause error.
  • Loading branch information
munkhuushmgl committed Dec 2, 2020
1 parent 1a2bcc2 commit 7f7f541bcf4d2f42b2f619c2ceb45f53c5d0e9eb
Showing with 4 additions and 1 deletion.
  1. +4 −1 samples/snippets/
@@ -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
# 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:

0 comments on commit 7f7f541

Please sign in to comment.