Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow auth to be None. Fix #773 #774

Merged
merged 2 commits into from
May 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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