Commit feaf1c68 authored by ryanss's avatar ryanss
Browse files

Add complex example to README Example Usage section

parent be8f5439
......@@ -43,6 +43,22 @@ Example Usage
op.sales_stage = "Approved"
sugar.set_entry(op)
# Extract all non-empty email fields from all Contacts in SugarCRM
emails = set()
contact_query = sugarcrm.Contact() # No filters provider finds all objects
contact_count = sugar.get_entries_count(contact_query, deleted=True)
print "Extracting emails from %d Contacts" % contact_count
# Grab 100 Contact objects at a time from SugarCRM
for offset in range(0, count, 100):
contacts = sugar.get_entry_list(contact_query, deleted=True,
max_results=100, offset=offset)
for contact in contacts:
for field in dir(contact):
if field.find("email") >= 0 and getattr(contact, field, "").find("@") >= 0:
emails.add(getattr(contact, field).lower())
print "Found %d emails" % len(emails)
Install
-------
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment