gspread-pandas
gspread-pandas copied to clipboard
Client authentication issue with gspread library
Hello! I've been using this library in an automated workflow for the last few months and started getting authentication errors on 1/28/24, which I noticed coincided with the release of gspread 6.0.0
. I started getting an 'AuthorizedSession' object is not callable
which I traced back to this line: https://github.com/aiguofer/gspread-pandas/blob/1a9be8dbb449235eca412e49edd71f6a5073a5b8/gspread_pandas/client.py#L92
where the gspread-pandas Client
instantiates a gspread Client
and passes in an AuthorizedSession argument. However, with the lastest gspread release, the Client
super init method does not take a session
argument (see line 41 of client.py
on the branch)
https://github.com/burnash/gspread/pull/1382/files#diff-4c3073178c56b478cd7537564a01ef8a43ead328aef864d8afa7e70625560d73
I ran into the same issue. As a workaround, installing gspread version 5.12.4 explicitly before gspread-pandas resolves it.
It's because Gspread 6 updates to the new Google API V4 and I believe they changed the autherization method. It looks like this project hasn't had a release in almost 2 years. Is this an abandoned project?
Hi! gspread released v6.0.1 recently, which may have fixed your issue. Can you check if it has?
Hi! gspread released v6.0.1 recently, which may have fixed your issue. Can you check if it has?
I checked just now. Same error. Interestingly, it seems I ran into this issue because I installed gspread locally through conda-forge, and that is still on version 5.12.4. When I deployed to Google Cloud Functions, that used the version from pip instead. Good to keep that in mind for the future, I suppose.
ah yes. this is due to an architechtural change in v5->v6. @lavigne958 knows more about it, and can provide more info, as made the change
Hey all, yeah unfortunately I haven't really used this project in years. I've been trying to maintain as best effort, but the changes necessary to support gspread 6 might be too much for me right now. I'll release a version that limits gspread < 6 (thanks @mephinet for the PR), but won't have time to make all the changes to make a new version compatible with 6. PRs welcome!
@aiguofer Understandable. I don't see myself having time to dive into it, so I guess the safer option long-term is to refactor to remove gspread-pandas? I'll have to discuss with my team about allocating dev time one way or the other.
Hi everyone, yes we updated the gspread architecture in v6 and now the gspread client requires an HTTPClient object at init.
it is provided when using the functions like gspread.service_account()
or gspread.oauth()
.
I'll make the necessary changes, first we should fixup gspread to be compliant with previous arguments in order to init a new client and optional arguments with default value.
then I can provide a PR here to upgrade and benefit from new code.
Hello everyone, it's done, we fixed the order of input arguments to init a new gspread client, it should now work out fo the box with gspread-6.0.2.
please let us know if it's not the case, we'll investigate.
Awesome thanks! I'll make a new release that supports >= 6.0.2
Well, I tried making the change today but unfortunately there's a few more changes that will need to happen. For example, there is now longer a Client.request
method, now that belongs to Client.http_client
. I'll likely need to dig a bit deeper into other breaking changes before I can make it compatible with v6, but sadly I don't have much time nowadays to work on the library.
Oh god you're right I did not think of this one.
Yes I'll make a new PR in gspread-formating for this change and I'll take this chance to test it a bit too.