-
Notifications
You must be signed in to change notification settings - Fork 22
Compare values and update only when different from previous #596
Copy link
Copy link
Closed
Description
Hi!
I have some code that pull some items from my wikibase, adds (or not) information, and then tries to write to the Wikibase:
This is the final snippet:
item.claims.add(data, action_if_exists=ActionIfExists.REPLACE_ALL)
old_item_dict = old_item.__dict__
new_item_dict = item.__dict__
if old_item_dict == new_item_dict:
print("No change")
else:
try:
item.write()
except ModificationFailed as e:
print(e)
pass
This comparison, however, is not working. I want to implement that ifelse statement to avoid talking to the server whenever I don't have anything new to write. Any thoughts?
Thanks!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels