From d83f77dd07c5c7971ab3331cbd565fea7c0f6118 Mon Sep 17 00:00:00 2001 From: Muflone Date: Sun, 6 Jun 2021 01:36:03 +0200 Subject: [PATCH] Added some other examples using contacts --- samples/contacts.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/samples/contacts.py b/samples/contacts.py index db2f94e..52163bd 100644 --- a/samples/contacts.py +++ b/samples/contacts.py @@ -85,3 +85,21 @@ # Delete a record api.delete(entity_id=results) print('delete') + +# Find customers from France with different languages +filters.append(Filter(field='lang', + compare_type=CompareType.NOT_EQUAL, + value='fr_FR')) +filters.append(Filter(field='country_id', + compare_type=CompareType.EQUAL, + value='France')) +results = api.search(filters=filters) +print('search', len(results), results) + +# Update those customers to French language +for entity_id in results: + api.update(entity_id=entity_id, + values={'lang': 'fr_FR'}) + print('updating ID', entity_id) +results = api.search(filters=filters) +print('search', len(results), results)