-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathexample_get_user.py
More file actions
44 lines (33 loc) · 858 Bytes
/
example_get_user.py
File metadata and controls
44 lines (33 loc) · 858 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import sys
import chargeover
import pprint
# For authentication, fill in these values from your ChargeOver
# server information under "Configuraion->API and Webhooks"
endpoint =
username =
password =
# Set this to True to use "COv1 Signature" authorization
key_auth = False
co = chargeover.ChargeOver(
endpoint,
username,
password,
key_auth = key_auth)
cdata = {
'company': "Acme Inc.",
'email': 'csmith@acme.co',
'external_key': "cid001"
}
id = co.create("customer", cdata)
if id is None:
pprint.pprint(co.get_last_response())
exit()
# Find a customer by id
cust = co.find_by_id("customer", id)
print "Customer from specified id"
pprint.pprint(cust)
# Find a customer by query
where {'external_key': 'cid001'}
customer = co.find("customer", where)
print "All customers matching search (in list)"
pprint.pprint(customer)