8000 Rename account_sid to username and auth_token to password add a new a… · yikaraman/twilio-python@31da20b · GitHub
[go: up one dir, main page]

Skip to content

Commit 31da20b

Browse files
author
matt
committed
Rename account_sid to username and auth_token to password add a new account_sid for none Account Sid auth
1 parent eec0ee6 commit 31da20b

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

tests/integration/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ def setUp(self):
1010
self.account_sid = 'AC' + 'a' * 32
1111
self.auth_token = 'AUTHTOKEN'
1212
self.holodeck = Holodeck()
13-
self.client = Client(account_sid=self.account_sid,
14-
auth_token=self.auth_token,
13+
self.client = Client(username=self.account_sid,
14+
password=self.auth_token,
1515
http_client=self.holodeck)

twilio/rest/__init__.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,14 @@
2323
class Client(object):
2424
""" A client for accessing the Twilio API. """
2525

26-
def __init__(self, account_sid=None, auth_token=None, http_client=None,
27-
environment=None):
26+
def __init__(self, username=None, password=None, account_sid=None,
27+
http_client=None, environment=None):
2828
"""
2929
Initializes the Twilio Client
3030
31-
:param str account_sid: Account Sid to authenticate with
32-
:param str auth_token: Auth Token to authenticate with
31+
:param str username: Username to authenticate with
32+
:param str password: Password to authenticate with
33+
:param str account_sid: Account Sid, defaults to Username
3334
:param HttpClient http_client: HttpClient, defaults to Httplib2Client
3435
:param dict environment: Environment to look for auth details, defaults to os.environ
3536
@@ -38,15 +39,17 @@ def __init__(self, account_sid=None, auth_token=None, http_client=None,
3839
"""
3940
environment = environment or os.environ
4041

41-
self.account_sid = account_sid or environment.get('TWILIO_ACCOUNT_SID')
42+
self.username = username or environment.get('TWILIO_ACCOUNT_SID')
4243
""" :type : str """
43-
self.auth_token = auth_token or environment.get('TWILIO_AUTH_TOKEN')
44+
self.password = password or environment.get('TWILIO_AUTH_TOKEN')
45+
""" :type : str """
46+
self.account_sid = account_sid or self.username
4447
""" :type : str """
4548

46-
if not self.account_sid or not self.auth_token:
49+
if not self.username or not self.password:
4750
raise TwilioException("Credentials are required to create a TwilioClient")
4851

49-
self.auth = (self.account_sid, self.auth_token)
52+
self.auth = (self.username, self.password)
5053
""" :type : tuple(str, str) """
5154
self.http_client = http_client or Httplib2Client()
5255
""" :type : HttpClient """

0 commit comments

Comments
 (0)
0