Skip to content

Commit

Permalink
Rename async parameter, be stricter about expecting a boolean
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronAtDuo committed Sep 28, 2018
1 parent 2c9de98 commit bd8a906
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,3 @@ install:
- pip install -r requirements-dev.txt
script:
- nose2
matrix:
allow_failures:
- python: 3.7-dev
8 changes: 4 additions & 4 deletions duo_client/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def auth(self,
username=None,
user_id=None,
ipaddr=None,
async=False,
async_txn=False,
type=None,
display_username=None,
pushinfo=None,
Expand All @@ -121,7 +121,7 @@ def auth(self,
"""
Perform second-factor authentication for a user.
If async is True, returns: {
If async_txn is True, returns: {
'txid': <str: transaction ID for use with auth_status>,
}
Expand All @@ -131,14 +131,14 @@ def auth(self,
'status_msg': <str:human-readable>,
}
If Trusted Devices is enabled, async is not True, and status is
If Trusted Devices is enabled, async_txn is not True, and status is
'allow', another item is returned:
* trusted_device_token: <str: device token for use with preauth>
"""
params = {
'factor': factor,
'async': str(int(bool(async))),
'async': str(int(async_txn)),
}
if username is not None:
params['username'] = username
Expand Down
8 changes: 4 additions & 4 deletions duo_client/auth_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,17 @@ def auth(self, username,
phone=PHONE1,
pushinfo=None,
ipaddr=None,
async=False):
async_txn=False):
"""
Returns True if authentication was a success, else False.
If 'async' is True, returns txid of the authentication transaction.
If 'async_txn' is True, returns txid of the authentication transaction.
"""
params = {
'user': username,
'factor': factor,
}
if async:
if async_txn:
params['async'] = '1'
if pushinfo is not None:
params['pushinfo'] = pushinfo
Expand All @@ -100,7 +100,7 @@ def auth(self, username,
response = self.json_api_call('POST', '/rest/v1/auth', params)
if self.auth_details:
return response
if async:
if async_txn:
return response['txid']
return response['result'] == 'allow'

Expand Down
2 changes: 1 addition & 1 deletion duo_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from __future__ import print_function
import six

__version__ = '3.3.0'
__version__ = '4.0.0'

import base64
import collections
Expand Down

0 comments on commit bd8a906

Please sign in to comment.