Skip to content

Add streaming notes to update example file #102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 12, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion test/examples/src/update_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@
doc_id=example_doc_id
).get_result()

# Note: for response byte stream use:
# document_as_byte_stream = client.get_document_as_stream(
# db=example_db_name,
# doc_id=example_doc_id
# ).get_result()

# Add Bob Smith's address to the document
document["address"] = "19 Front Street, Darlington, DL5 1TY"

Expand All @@ -34,6 +40,12 @@
document=document
).get_result()

# Note: for request byte stream use:
# update_document_response = client.post_document(
# db=example_db_name,
# document=document_as_byte_stream
# ).get_result()

# Keep track with the revision number of the document object:
document["_rev"] = update_document_response["rev"]
print(f'You have updated the document:\n' +
Expand All @@ -43,4 +55,4 @@
if ae.code == 404:
print('Cannot delete document because either ' +
f'"{example_db_name}" database or "{example_doc_id}" ' +
'document was not found.')
'document was not found.')