File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 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.
3838overwrite_result = pubnub_2 .set_uuid_metadata (uuid = "SampleUser" , name = "Jane Doe" ).sync ()
3939new_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.
4545updated_user = {** sample_user , "custom" : {"age" : 43 , "address" : "321 Other St." }}
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 ()
5454except 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 } " )
You can’t perform that action at this time.
0 commit comments