Skip to content

Commit fac26ee

Browse files
committed
Fixing token fetch flow
1 parent b5a6490 commit fac26ee

File tree

6 files changed

+5
-33
lines changed

6 files changed

+5
-33
lines changed

twilio/http/orgs_token_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from twilio.base.version import Version
22
from twilio.http.token_manager import TokenManager
3-
from twilio.rest.preview_iam.organizations.token import TokenList
3+
from twilio.rest.preview_iam.v1.token import TokenList
44

55

66
class OrgTokenManager(TokenManager):

twilio/rest/preview_iam/PreviewIamBase.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def __init__(self, twilio: Client):
2424
2525
:returns: Domain for PreviewIam
2626
"""
27-
super().__init__(twilio, "https://preview.twilio.com/iam")
27+
super().__init__(twilio, "https://preview-iam.twilio.com")
2828
self._organizations: Optional[Organizations] = None
2929
self._v1: Optional[V1] = None
3030
# self._token: Optional[TokenList] = None

twilio/rest/preview_iam/__init__.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -13,45 +13,20 @@ class PreviewIam(PreviewIamBase):
1313

1414
@property
1515
def accounts(self) -> AccountList:
16-
warn(
17-
"accounts is deprecated. Use organizations.accounts instead.",
18-
DeprecationWarning,
19-
stacklevel=2,
20-
)
2116
return self.organizations.accounts
2217

2318
@property
2419
def role_assignments(self) -> RoleAssignmentList:
25-
warn(
26-
"role_assignments is deprecated. Use organizations.role_assignments instead.",
27-
DeprecationWarning,
28-
stacklevel=2,
29-
)
3020
return self.organizations.role_assignments
3121

3222
# @property
3323
# def users(self) -> UserList:
34-
# warn(
35-
# "users is deprecated. Use organizations.users instead.",
36-
# DeprecationWarning,
37-
# stacklevel=2,
38-
# )
3924
# return self.organizations.users
4025

4126
@property
4227
def token(self) -> TokenList:
43-
warn(
44-
"token is deprecated. Use v1.token instead.",
45-
DeprecationWarning,
46-
stacklevel=2,
47-
)
4828
return self.v1.token
4929

5030
@property
5131
def authorize(self) -> AuthorizeList:
52-
warn(
53-
"authorize is deprecated. Use v1.authorize instead.",
54-
DeprecationWarning,
55-
stacklevel=2,
56-
)
5732
return self.v1.authorize

twilio/rest/preview_iam/organizations/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def __init__(self, domain: Domain):
2727
2828
:param domain: The Twilio.preview_iam domain
2929
"""
30-
super().__init__(domain, "Organizations")
30+
super().__init__(domain, "organizations")
3131
self._accounts: Optional[AccountList] = None
3232
self._role_assignments: Optional[RoleAssignmentList] = None
3333
self._users: Optional[UserList] = None

twilio/rest/preview_iam/v1/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def __init__(self, domain: Domain):
2727
2828
:param domain: The Twilio.preview_iam domain
2929
"""
30-
super().__init__(domain, "V1")
30+
super().__init__(domain, "v1")
3131
self._token: Optional[TokenList] = None
3232
self._authorize: Optional[AuthorizeList] = None
3333

twilio/rest/preview_iam/v1/token.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def __init__(self, version: Version):
5959
"""
6060
super().__init__(version)
6161

62-
self._uri = "https://preview-iam.twilio.com/v1/token"
62+
self._uri = "/token"
6363

6464
def create(
6565
self,
@@ -100,12 +100,9 @@ def create(
100100
}
101101
)
102102
headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})
103-
print(f'{data}')
104-
print(f'{headers}')
105103
payload = self._version.create(
106104
method="POST", uri=self._uri, data=data, headers=headers
107105
)
108-
print('rest method output...')
109106
return TokenInstance(self._version, payload)
110107

111108
async def create_async(

0 commit comments

Comments
 (0)