本文介绍了使用gsutil与谷歌驱动器(不是谷歌云存储)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用的。

我console.developers.google.com产生的ClientID - 即允许python脚本把文件复制到谷歌驱动器:

I generate ClientID in console.developers.google.com - that allow put files to Google Drive by python script:

#!/usr/bin/env python

from apiclient.discovery import build
from apiclient.http import MediaFileUpload
import httplib2
from oauth2client.client import SignedJwtAssertionCredentials

credentials = SignedJwtAssertionCredentials(
service_account_name='301714561983-nkd8kalz1op3bdjn75ija1b7ef1sslpr@developer.gserviceaccount.com',
private_key='''-----BEGIN PRIVATE KEY-----
приватный ключик
-----END PRIVATE KEY-----''',
        scope = [
                'https://www.googleapis.com/auth/drive',
                'https://www.googleapis.com/auth/drive.file',
                'https://www.googleapis.com/auth/drive.appdata',
                'https://www.googleapis.com/auth/drive.apps.readonly'
        ]
)

http = httplib2.Http()
http = credentials.authorize(http)

drive_folder_id = '0C3ZU6kySEIuCT0ANM3RRVE1iME0' #folder id

service = build('drive', 'v2', http=http)

media_body = MediaFileUpload('document.txt')
body = {
        'title': 'document.txt',
        'description': 'backup',
        'mimeType': 'text/plain',
        'parents': [{'id': drive_folder_id}]
}

file = service.files().insert(
        body=body,
        media_body=media_body).execute()

和我想使用的gsutil的rsync 作为同步我与谷歌驱动器的数据。
任何人都知道关于配置博托配置为身份验证在谷歌驱动器?如何做到这一点,如果这可能吗?

And I want use gsutil rsync for sync my data with Google Drive.Anybody known about configure boto config for authenticate at Google Drive? How to do this, if this possible?

目前我使用的客户端ID(配置的gsutil -e),用于发现访问谷歌云存储:

Currently I use ClientID (gsutil config -e) for discover access to google cloud storage:

$ gsutil ls gs://uspto-pair/applications/0800401*
gs://uspto-pair/applications/08004010.zip
gs://uspto-pair/applications/08004011.zip
gs://uspto-pair/applications/08004012.zip
gs://uspto-pair/applications/08004013.zip
gs://uspto-pair/applications/08004016.zip
gs://uspto-pair/applications/08004017.zip
gs://uspto-pair/applications/08004019.zip

但我不能访问文件夹(路径或按文件夹ID)。可能是为获取在谷歌云端硬盘文件夹任何已知的格式的URI(与出桶或与谷歌驱动器的某些默认桶)?

but i can't access to folder (by path or by folder ID). May be anybody known format uri for access to folders on Google Drive (with out bucket or with some default bucket for Google Drive)?

推荐答案

可能是有人知道格式的URI在谷歌访问光驱文件夹(无桶或与谷歌驱动器的某些默认桶)?

"May be anybody knows format URI for accessing folders on Google Drive (without bucket or with some default bucket for Google Drive)?"

=================================

=================================

的作者:

•Cyber​​duck的

• CyberDuck

•Grive

•InSync的

知道如何访问谷歌驱动器,这是肯定的。其中两个是开源软件:

Know how to access Google Drive, that's for sure. Two of them are Open Source Software:

这篇关于使用gsutil与谷歌驱动器(不是谷歌云存储)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 05:11