forked from LeastAuthority/leastauthority.com
/
confirm.py
executable file
·33 lines (25 loc) · 923 Bytes
/
confirm.py
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
#!/usr/bin/python
import os, sys
from twisted.internet import reactor
from twisted.python.failure import Failure
from lae_automation.confirmation import send_signup_confirmation
if len(sys.argv) < 4:
print "Usage: python confirm.py CUSTOMER_NAME CUSTOMER_EMAIL INTRODUCER_FURL [CUSTOMER_KEYINFO]"
print "Happy confirmation-sending!"
sys.exit(1)
customer_name = sys.argv[1]
customer_email = sys.argv[2]
external_introducer_furl = sys.argv[3]
if len(sys.argv) > 4:
customer_keyinfo = sys.argv[4]
else:
customer_keyinfo = ''
def cb(x):
print str(x)
if isinstance(x, Failure) and hasattr(x.value, 'response'):
print x.value.response
d = send_signup_confirmation(customer_name, customer_email, external_introducer_furl, customer_keyinfo,
sys.stdout, sys.stderr)
d.addBoth(cb)
d.addCallbacks(lambda ign: os._exit(0), lambda ign: os._exit(1))
reactor.run()