GithubHelp home page GithubHelp logo

fails opening a folder about fs.googledrivefs HOT 9 CLOSED

rkhwaja avatar rkhwaja commented on July 17, 2024 1
fails opening a folder

from fs.googledrivefs.

Comments (9)

msb avatar msb commented on July 17, 2024

My case is similar to @simonm3 - I have a credentials for a service account that has permission on a GCP folder. The folder would have to be referenced by a file id but it isn't clear to me how this would be done using either fs.opendir() or a path.

from fs.googledrivefs.

rkhwaja avatar rkhwaja commented on July 17, 2024

Going by the code in your other issue, I think that the format of your URI is wrong - the "?access_token=..." part has to be at the end, after the subdirectory part.

from fs.googledrivefs.

rkhwaja avatar rkhwaja commented on July 17, 2024

Is GCP is a different service? This project supports "Google Drive". There's another pyfilesystem plugin called fs-gcsfs which supports "Google Cloud Storage"

from fs.googledrivefs.

simonm3 avatar simonm3 commented on July 17, 2024

@rkhwaja you may be right about the format. however this still only opens the root folder. code below lists the root folder contents.

gd = fs.open_fs(f"googledrive://eedata/{creds.gdrive()}")
gd.listdir("/")

from fs.googledrivefs.

simonm3 avatar simonm3 commented on July 17, 2024

It works if I add an extra slash fs.open_fs(f"googledrive:///eedata/{creds.gdrive()}")

However the pyfilesystem url does not have a slash at the start of a folder in the examples https://docs.pyfilesystem.org/en/latest/openers.html

from fs.googledrivefs.

simonm3 avatar simonm3 commented on July 17, 2024

Also the format shown in documentation is creds@resource.

Ideally the creds should be in similar format regardless of file system used. So for google drive API they should appear before the resource and googledrivefs should convert that into whatever format google uses.

from fs.googledrivefs.

msb avatar msb commented on July 17, 2024

My mistake - I should have written Google Drive folder (it's the service account that is part of the Google Clouds Platform). My use case is supported by the native Drive API - it's a method for a user to grant an application permission to work on a sub-set of the user's files.

from fs.googledrivefs.

rkhwaja avatar rkhwaja commented on July 17, 2024

My case is similar to @simonm3 - I have a credentials for a service account that has permission on a GCP folder. The folder would have to be referenced by a file id but it isn't clear to me how this would be done using either fs.opendir() or a path.

My case is similar to @simonm3 - I have a credentials for a service account that has permission on a GCP folder. The folder would have to be referenced by a file id but it isn't clear to me how this would be done using either fs.opendir() or a path.

Since this project is a plugin for pyfilesystem2, it only uses "paths", although I suppose that the definition of that is somewhat up to the individual plugins - I'm not sure how far you can push that. We can add custom methods that do something specific with the filesystem (e.g. add_parent, remove_parent) but that aren't relevant to filesystems in general.

from fs.googledrivefs.

msb avatar msb commented on July 17, 2024

Thanks for your response @rkhwaja. I have made a fork and implemented support for a sub-tree specified by an ID. I have also used it in an example project with an explanatory readme. I've had second thoughts about the approach in the fork and think maybe the root directory could better be specified by a parameter (say root_dir_id) passed to the GoogleDriveFSOpener. If you like this idea, I'm happy to re-work and create a CR.

from fs.googledrivefs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.