Open Cing2 opened 4 years ago
@Cing2
How is it going with this project?
it is actively maintained, at least as long as `iterative/dvc is alive and maintained.
However I could not find how to get certain fields of a file, like id, name, parents. etc
I assume you already found the file listing API - https://pythonhosted.org/PyDrive/filelist.html#file-listing-made-easy right? Then it already has a small example how to get title
and id
(and the same way you can access other file attributes). Am I missing something in your question?
Yes, I can see how get the attributes after the download. But how do you select to only download the attributes you need. Which will reduce data and time needed. https://developers.google.com/drive/api/v3/reference/files/list in the docs you can have an parameter 'fields', to select the attributes you need.
Have you tried to pass param={"fields": ...}
to the list call? .. I think it should support it as well.
Yes I did but got an ApiRequestError. This is what I tried:
file_list = drive.ListFile({'fields': 'id, name',
'q': "'root' in parents and trashed=false"}).GetList()
Try this: 'fields': 'items(id,title)'
- check the API docs for the exact syntax on how to specify the list of fields you'd like to get.
Thank you, I see now that you are still using the v2 version. Although this is not clear on the home page.
Yes, but I think the syntax for fields is the same across v2 and v3 - check these examples https://developers.google.com/drive/api/v3/fields-parameter
Ah oke, I was looking at this one: https://developers.google.com/drive/api/v3/search-files
@Cing2 sure. I keep it open with the documentation
label. Hopefully we'll get a contribution to improve it and put some examples.
Hi,
I think this issue shouldn't be handled just by changing the documentation.
v3 has some field differencies with v2. At least: 'fields': 'items(title)'
vs 'fields': 'files(name)'
As v3 has been out for many years, it is natural for people to develop using the v3 documentation as reference (my case). I couldn't figure out why I could download specific fields only with the API and not with PyDrive2, and the only explanation I could find is this issue.
Can PyDrive2 be updated to use the v3 fields?
Hey,
How is it going with this project? I am planning to use this for my own project and was trying some things. However I could not find how to get certain fields of a file, like id, name, parents. etc.. The documentation also isn't clear this one. I am willing to help with the project, to get it more usable. Love to hear from you.
Regards,