Skip to content

Commit e83787a

Browse files
author
Sebastian Molenda
committed
examples adjustment
1 parent 445a695 commit e83787a

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

examples/native_sync/using_etag.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@
3232
).sync()
3333

3434
# We store the eTag for the user for further updates.
35-
e_tag = set_result.result.data.get('eTag')
35+
original_e_tag = set_result.result.data.get('eTag')
3636

3737
# Another client sets the user meta with the same UUID but different data.
3838
overwrite_result = pubnub_2.set_uuid_metadata(uuid="SampleUser", name="Jane Doe").sync()
3939
new_e_tag = overwrite_result.result.data.get('eTag')
4040

4141
# We can verify that there is a new eTag for the user.
42-
print(f"{e_tag == new_e_tag=}")
42+
print(f"{original_e_tag == new_e_tag=}")
4343

4444
# We modify the user and try to update it.
4545
updated_user = {**sample_user, "custom": {"age": 43, "address": "321 Other St."}}
@@ -50,8 +50,9 @@
5050
include_custom=True,
5151
include_status=True,
5252
include_type=True
53-
).if_matches_etag(e_tag).sync()
53+
).if_matches_etag(original_e_tag).sync()
5454
except PubNubException as e:
5555
# We get an exception and after reading the error message we can see that the reason is that the eTag is outdated.
5656
print(f"Update failed: {e.get_error_message().get('message')}")
57-
57+
except Exception as e:
58+
print(f"Unexpected error: {e}")

0 commit comments

Comments
 (0)