google-api-python-client

Google Sheets API “update” method Http Error 400

旧巷老猫 提交于 2019-12-18 17:06:07
问题 I am trying to make a python script that reads and writes to a google spreadsheet. I've basically copied the python quickstart script at https://developers.google.com/sheets/quickstart/python and modified it using the reference at https://developers.google.com/resources/api-libraries/documentation/sheets/v4/python/latest/. Everything works fine with the "get" method shown in the quickstart script. I can read the sheet with no errors. To use "update" instead of "get" (write to the sheet

How to upload file to google drive with service account credential

自闭症网瘾萝莉.ら 提交于 2019-12-18 16:56:32
问题 I wanted to upload the files to my Google Drive using a Google service account credentials. I downloaded credential as a JSON file from Google Developer Console, and got credential from it. Here is my code snippet. google_drive_service = discovery.build('drive', 'v3', credentials=ServiceAccountCredentials.from_json_keyfile_name os.path.join(settings.CLIENT_PATH, settings.CLIENT_SECRET_FILE), scopes=settings.SCOPES)) media = MediaFileUpload(tmp_file_path, mimetype=tmp_file.content_type,

How to do OAuth-requiring operations in a GAE Task Queue?

China☆狼群 提交于 2019-12-18 13:38:48
问题 I have a simple Google App Engine app that includes a /update page which updates a YouTube playlist. It looks like this: class UpdatePage(webapp2.RequestHandler): @decorator.oauth_required def get(self): update_result = self.update_playlist() ... routes = [('/update', UpdatePage), (decorator.callback_path, decorator.callback_handler())] app = webapp2.WSGIApplication(routes, debug=True) It works as expected and the update_playlist() method does its job, but it turns out that under some

Google contacts import using oauth2.0

故事扮演 提交于 2019-12-17 22:43:41
问题 What possible ways to import google contacts using python and oauth2.0 exists? We successfully got credentials, and our application requests access to contacts, but after getting credentials I can't find way to discover contacts api. So things like: from apiclient.discover import build import httplib2 http = httplib2.Http() #Authorization service = build("contacts", "v3", http=http) Gives us UnknownApiNameOrVersion exception. It looks like Contacts API not in list of supported APIs for

processingFailure error (400) while retrieving CommentThreads list

安稳与你 提交于 2019-12-17 22:29:27
问题 I a trying to retrieve all the comments of a video via Python iteration/paging. I am logged correctly with a developer key import googleapiclient.discovery as gg import googleapiclient.errors as gge yt = gg.build(api_service_name= 'youtube', api_version= 'v3', developerKey = M_KEY) comments= [] page= '' while True: request = yt.commentThreads().list( part= "snippet,replies", order= "relevance", maxResults= 100, pageToken= page, textFormat= "plainText", videoId= video['id'] # video is a static

Google Drive Python API resumable upload error 401 after 2 hours

血红的双手。 提交于 2019-12-17 17:06:50
问题 First of all, I'm sorry if this is a too silly question... this is the first time I'm trying to use any of the technologies involved in this script (Python, the drive api, oauth 2.0, etc). I swear I've been searching and trying this for about a week before posting the question. hehehe I'm trying to use the google-api-python-client to upload a big file (3.5GiB) that is on a terminal only Linux Debian. I've had some success uploading small files, but when I try to upload the big file, the

Google AppEngine to Fusion Tables with Service Accounts

≯℡__Kan透↙ 提交于 2019-12-14 03:42:37
问题 Late to the game on migrating to the /v1 Fusion Table API but no holding off any longer. I'm using Python on AppEngine and trying to connect to Google Fusion Tables with Google Service Accounts (the more complicated cousin of OAuth2 for server side apps that uses JSON Web Tokens) I found another question that pointed me to some documentation for using Service Accounts with Google Prediction API. Fusion Table and Google Service Accounts So far I've got import httplib2 from oauth2client

Update single row formatting for entire sheet

蹲街弑〆低调 提交于 2019-12-14 02:14:04
问题 I want to just apply a formatting from a JSON Entry. The first thing I did was make my desirable format on my spreadsheet for the second row of all columns. I then retrieved them with a .get request (from A2 to AO3). request = google_api.service.spreadsheets().get( spreadsheetId=ss_id, ranges="Tab1!A2:AO3", includeGridData=True).execute() The next thing I did was collect each of the formats for each column and record them in a dictionary. my_dictionary_of_formats = {} row_values = row_1[

google-api-python-client doesn't work and makes Spyder to fail when starting

拥有回忆 提交于 2019-12-13 21:21:14
问题 I installed google-api-python-client on my Ubuntu 13.04 with sudo easy_install --upgrade google-api-python-client as it is said here. After that I tried to translate something in python with it. I took the code from here. >>> from apiclient.discovery import build >>> service = build('translate', 'v2', developerKey='MyApiKey') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python2.7/dist-packages/google_api_python_client-1.1-py2.7.egg/oauth2client

403 error / Forbidden when accessing https://www.googleapis.com/auth/plus.profiles.read in python

混江龙づ霸主 提交于 2019-12-13 16:12:36
问题 I am getting an "HttpError 403' when I try to access an user profile. I followed the tutorial and setup all the rights in the Central Panel. Here is the code: import httplib2 import pprint from apiclient.discovery import build from oauth2client.client import SignedJwtAssertionCredentials SERVICE_ACCOUNT_EMAIL = 'xxxx@developer.gserviceaccount.com' SERVICE_ACCOUNT_PKCS12_FILE_PATH = '/xxxx/privatekey.pem' USER_EMAIL = 'xyz@test.com' SCOPES = ['https://www.googleapis.com/auth/plus.profiles.read