Skip to content

Commit

Permalink
Allow auth to be None. Fix #773 (#774)
Browse files Browse the repository at this point in the history
* Allow auth to be None. Fix #773
* Update import path of Authlib
  • Loading branch information
lepture authored May 19, 2020
1 parent ad607bc commit 22b76a7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/advanced.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Using ``Authlib`` instead of ``google-auth``. Similar to `google.auth.transport.

import json
from gspread import Client
from authlib.client import AssertionSession
from authlib.integrations.requests_client import AssertionSession

def create_assertion_session(conf_file, scopes, subject=None):
with open(conf_file, 'r') as f:
Expand Down
7 changes: 5 additions & 2 deletions gspread/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@ class Client(object):
"""

def __init__(self, auth, session=None):
self.auth = convert_credentials(auth)
self.session = session or AuthorizedSession(self.auth)
if auth is not None:
self.auth = convert_credentials(auth)
self.session = session or AuthorizedSession(self.auth)
else:
self.session = session

def login(self):
from google.auth.transport.requests import Request
Expand Down

0 comments on commit 22b76a7

Please sign in to comment.