google-drive-api

showing subfolders in google drive using python api

我与影子孤独终老i 提交于 2021-01-28 07:48:41
问题 I'm trying to list all folders(and subfolders) in google drive. My root folder has six subfolders in it. but my code is only showing files. def credentials_from_file(): """Load credentials from a service account file Args: None Returns: service account credential object https://developers.google.com/identity/protocols/OAuth2ServiceAccount """ # https://developers.google.com/identity/protocols/googlescopes#drivev3 SCOPES = [ 'https://www.googleapis.com/auth/drive' ] SERVICE_ACCOUNT_FILE = '.

Google Drive API Python Service Account Example

那年仲夏 提交于 2021-01-28 07:37:07
问题 Is it possible to authenticate against the Google Drive API using a Google Service Account, rather than an OAuth flow ? The Python examples for Google Drive use OAuth - Google drive Python Quick start However I can't find any Service Account examples. The majority of the other Google APIs I use (Translate, Cloud Vision) do use Service Account however, so I'd like to deprecate my Google Drive OAuth code for consistency. 回答1: The best service account python example that i know of is the one for

How to download dynamic files from google drive

杀马特。学长 韩版系。学妹 提交于 2021-01-28 07:34:59
问题 noob question, I'm just getting started with Google Drive API v3. How can I download dynamic file from google drive when I only have fileId. file can be, image, pdf, or docs. I tried searching but I couldn't found any reference or example related to this. This what I have so far but it only download specific file extension. downloadFile(req, res) { const auth = new google.auth.JWT( client_email, null, private_key, SCOPES, ); const { fileId } = req.params; const drive = google.drive({ version:

Permissions access

*爱你&永不变心* 提交于 2021-01-28 07:27:46
问题 The new version 2 API introduce methods to access permissions. Apps can create, delete, modify and read one permission but why the get method does't return the value property which limits what apps can do with permissions ? The JavaScript embeddable sharing component is a solution for some use cases but not for all. 回答1: The value property is omitted in order to preserve privacy. A user that can read the permissions on a file should not be able to see the email addresses of all the other

Permissions access

一世执手 提交于 2021-01-28 06:50:26
问题 The new version 2 API introduce methods to access permissions. Apps can create, delete, modify and read one permission but why the get method does't return the value property which limits what apps can do with permissions ? The JavaScript embeddable sharing component is a solution for some use cases but not for all. 回答1: The value property is omitted in order to preserve privacy. A user that can read the permissions on a file should not be able to see the email addresses of all the other

Google api redirect uri issue while reading google sheet from java

醉酒当歌 提交于 2021-01-28 06:12:26
问题 I am using oauth2 google drive API to read data from a google sheet in Java. I have an working sample on my local machine. But when I deploy it on the remote server, at the time of authentication the API returns a URL which is to be opened in browser. The URL is like below : https://accounts.google.com/o/oauth2/auth?access_type=online&approval_prompt=auto&client_id=my.client.id&redirect_uri=http://**localhost:58305**/Callback&response_type=code&scope=https://www.googleapis.com/auth/drive

Downloading a file from Google Drive in Javascript client

雨燕双飞 提交于 2021-01-28 05:28:33
问题 I'm trying to integrate the Google Drive in my angular application So that our users can copy the content from docs and download their images to my application. As per the file:get API Documentation, I'm using the below code to get the file var request = gapi.client.drive.files.get({ 'fileId': fileId }); var temp = this; request.execute(function (resp) { }); But in the response I'm getting only File name and ID.There is no download URL which is required for downloadFile function. Response:

How I can upload file to google drive with google drive api?

末鹿安然 提交于 2021-01-28 05:07:24
问题 I did as in the documentation (https://developers.google.com/drive/api/v3/manage-uploads#http---single-request), but it doesn't work: var fileMetadata = { name: e.target.files[j].name, parents: this.currentDirectoryId ? [this.currentDirectoryId] : [] } var media = { mimeType: e.target.files[j].type, body: e.target.files[j] } window.gapi.client.drive.files.create({ resource: fileMetadata, media: media, fields: 'id, name, mimeType, createdTime' }).then(res => console.log(res)) File is created,

How can I use Google Apps Script to move files between personal Google Drives and Team Drives?

主宰稳场 提交于 2021-01-28 05:07:05
问题 Recently, I gained access to Google Team Drive via Google's Team Drive early adopter program. I created a Google Docs file called Hello, world! , and then wrote a short Google Apps Script function which uses an addFile() method to update which Google Drive folder the file is attached to: function move_or_link_file() { var source = DriveApp.getFolderById("<sourceID>"); var fileiter = source.getFilesByName("Hello, world!"); var dest = DriveApp.getFolderById("<destID>"); while (fileiter.hasNext(

How to correctly read PDF into nodejs Buffer from Google Drive API's export method?

眉间皱痕 提交于 2021-01-28 04:42:37
问题 I'm trying to read a PDF from the Google Drive v2 API export method into a nodejs Buffer so it can be emailed as an attachment or saved, but when I view it, it looks blank, like all whitespace. I'd expect the PDF to appear the same as when exported and viewed through the Google Drive browser app. Namely that something shows, since the content-length: 55243 . I've tried the following: var drive = google.drive('v2'); drive.files.export({ auth: auth, fileId: ..., mimeType: 'application/pdf' })