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)?
With Google Cloud Storage you can upload/download a file, delete a file, obtain a list of files, or obtain the size of a given file. Google Drive, on the other hand, is used for storing personal files and it's free up to 15 GB across all your different personal services offered by Google.
You can use gsutil to do a wide range of bucket and object management tasks, including: Creating and deleting buckets. Uploading, downloading, and deleting objects.
"gcloud" can create and manage Google Cloud resources while "gsutil" cannot do so. "gsutil" can manipulate buckets, bucket's objects and bucket ACLs on GCS(Google Cloud Storage) while "gcloud" cannot do so.
"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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With