Skip to content

Commit 28ef14a

Browse files
authored
Update connection.py
I have found that I couldn't assign a single value tuple without a trailing comma. If credentials is provided as `(app_id)` it ends up being turned in to a str (even if you explicitly cast it as a tuple) thus failing the tuple instance check. If you use `(app_id,)` everything works. I added a check that will ensure it is a single value tuple by converting string to tuple (using the necessary trailing comma).
1 parent 691c6eb commit 28ef14a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

O365/connection.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,8 @@ def __init__(self, credentials, *, scopes=None,
365365
(client_id, client_secret)
366366
"""
367367
if auth_flow_type == 'public': # allow client id only for public flow
368+
if isinstance(credentials, str):
369+
credentials = (credentials,)
368370
if not isinstance(credentials, tuple) or len(credentials) != 1 or (not credentials[0]):
369371
raise ValueError('Provide client id only for public flow credentials')
370372
else:

0 commit comments

Comments
 (0)