My favorites | Sign in
Logo
             
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/python
#
# The MIT License
#
# Copyright (c) 2008 Silas Sewell
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

__author__ = 'silas@sewell.ch (Silas Sewell)'

from pf.pf_auth import PfAuth

call_status = {0: 'No message.',
1: 'A PIN is Entered',
2: 'No PIN Entered',
3: '# Not Pressed After Entry',
4: 'No Phone Input - Timed Out ',
5: 'PIN Expired and Not Changed',
6: 'Used Cache',
7: 'Bypassed Auth',
10: 'Call Disconnected',
11: 'Call Timed Out ',
12: 'Invalid Phone Input',
13: 'Got Voicemail',
14: 'User is Blocked',
100: 'Invalid Phone Number',
101: 'Phone Busy',
102: 'Configuration Issue',
103: 'International Calls Not Allowed',
104: 'PIN Mode Not Allowed',
105: 'Account Locked',
106: 'Invalid Message',
107: 'Invalid Phone Number Format',
108: 'User Hung Up the Phone',
109: 'Insufficient Balance',
110: 'Phone Extensions Not Allowed',
111: 'Invalid Extension',
112: 'Fraud Code Entered'}

# Authenicate number
response = PfAuth.pf_authenticate(phone_number='3035551234')

# Get response
authenicated = response.get('authenticated', False)
call_status_code = response.get('call_status', 0)
error_id = response.get('error_id', 0)

# Print results
print '-'*80
print 'Authenicated:\t', authenicated
print 'Call Status:\t', '%s [%s]' % (call_status[call_status_code], call_status_code)
print 'Error ID:\t', error_id
print '-'*80
Show details Hide details

Change log

r246 by si...@sewell.ch on Apr 12, 2009   Diff
Switched back to MIT.
Go to: 
Project members, sign in to write a code review

Older revisions

r162 by si...@sewell.ch on Jan 03, 2009   Diff
Add legacy python-phonefactor code.
All revisions of this file

File info

Size: 2759 bytes, 69 lines
Hosted by Google Code