googledriveapi下载速度是s

2024-09-24 00:31:10 发布

您现在位置:Python中文网/ 问答频道 /正文

1.)我有24mbit的下载速度。我可以用我的24mbps下载谷歌CHROME(网络浏览器)。但当我尝试用api从python程序下载文件时,我最多可以下载12mbps。我不知道怎么解决这个问题? 这是我的第一个问题,我也有一个问题。 2.)如果我验证我的应用程序,这个问题就会消失。甚至我都不知道我应该写些什么给这些图片:https://i.imgur.com/eZg8pUq.png

我有py文件,不是网站。使用googledriveapi。在

我试着在c上下载文件。它和python的下载速度一样。在

        '''
        SCOPES = 'https://www.googleapis.com/auth/drive'
        CLIENT_SECRET_FILE = 'client_secret.json'
        APPLICATION_NAME = 'NXDTools'
        authInst = auth.auth(SCOPES, CLIENT_SECRET_FILE,APPLICATION_NAME)
        credentials = authInst.getCredentials()'''

   def downloadfile(self):
        http = credentials.authorize(httplib2.Http())
        drive_service = discovery.build('drive', 'v3', http=http, cache_discovery=False)
        request = drive_service.files().get_media(fileId=link)

        file = drive_service.files().get(fileId=link).execute()
        print(file['name']) 
        fh = io.FileIO('E:\\abc.zip', 'wb')


        downloader = MediaIoBaseDownload(fh, request, chunksize=1024*1024) #1mb chunk size default


        done = False

        while done is False:
            gecensure = time.time()
            status, done = downloader.next_chunk()
            gecensure=time.time()-gecensure
            print(gecensure)

Tags: 文件httpscomclientauthfalsehttpsecret