ServiceAccount does not work correctly
See original GitHub issueIf you have a service account and you give access to it via the email. In this case, the file, when queried by drive looks like this:
{'id': 'some id here', 'name': 'some spreadheet name here'}]
This breaks here: https://github.com/aiguofer/gspread-pandas/blob/master/gspread_pandas/client.py#L256-L265
Since there is no parent, it raises an error, as it somehow expects said key to be there.
I hacked around that like this and it works:
def _list_spreadsheet_files(self, q):
files = self._query_drive(q)
for f in files:
try:
parent = next(
d for d in self._dirs + [self._root] if d["id"] in f.get("parents", {})
)
f["path"] = parent.get("path", "/")
except StopIteration:
f["path"] = "/"
return remove_keys_from_list(files, ["parents"])
I’m not really, really sure what I’m doing here, hence I didn’t make a PR. Happy to do so, if you think this would work.
Issue Analytics
- State:
- Created 4 years ago
- Comments:13 (10 by maintainers)
Top Results From Across the Web
The serviceaccount settings doesn't work, but ... - GitHub
Summary. I'm using WinSW with the YAML config format, and using serviceaccount does not work: image. But switching it to serviceAccount ...
Read more >Troubleshoot IAM role issues with service accounts in Amazon ...
I try to use an AWS Identity and Access Management (IAM) role for a service account. But my Amazon Elastic Kubernetes Service (Amazon...
Read more >Configure Service Accounts for Pods - Kubernetes
A service account provides an identity for processes that run in a Pod, and maps to a ServiceAccount object. When you authenticate to...
Read more >GCP Service Account roles do not work correctly - Server Fault
So if I run the following: ``` gcloud projects add-iam-policy-binding PROJECT_ID \ --member serviceAccount:terraform@PROJECT_ID.iam.
Read more >Pods in GKE return "error looking up service account"
We can resolve this error by rolebinding the service account with a new namespace. If the existing service account is in default namespace...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Btw, I just pushed a new version which should include all the aformentioned changes.
Ahh, you were using your own scope I take it? I’ve added some checks now so it’ll still work and give you a message about the missing permissions (see https://github.com/aiguofer/gspread-pandas/commit/e8527fe56679088b333d66fa7c32c4a1e5b1db83).
Let me know if you have any other issues/suggestions/etc!