Drive python api - how to get multiple files at once

i used to use pygdrive3 to connect to google drive. Is there any wat either in this package or google-api-python-client with i could get more files with one request? The files are relative small, but i' d like to fetch 100 pieces at once.

Is there any method for this?

I could do of course to use .files().get_media(fileId=...).execute() 100 times but it' s a quite slow execution.

1 answer

  • answered 2019-09-09 12:26 Simon Fink

    What I have done in one of my projects is to setup a thread pool and let each of the threads start a request. To do so try following snippets (which you need to adapt to your use case):

    from pathos.threading import ThreadPool as Pool
    
    N = 10 # number of threads
    my_pool =  = Pool(N)
    
    my_pool.amap(<function>, <args>)