4
votes

gsutil use boto configuration file for authenticate at Google Cloud Storage.

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()

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?

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

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)?

2
did you ever resolve this?seanv507

2 Answers

1
votes

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

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

The authors of:

• CyberDuck

• Grive

• InSync

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

https://cyberduck.io/

https://www.insynchq.com/downloads

http://www.howtogeek.com/130380/how-to-use-google-drive-on-linux-2-unofficial-solutions/

http://www.webupd8.org/2012/05/grive-open-source-google-drive-client.html

0
votes

gsutil tool is specific for Accessing files, putting files on buckets in Google Cloud Storage.