google-api-python-client

User rate limit exceeded after a few requests

血红的双手。 提交于 2019-12-04 07:42:27
I am using Google Drive API through pydrive to move files between two google drive accounts. I have been testing with a folder with 16 files. My code always raises an error in the sixth file "User rate limit exceeded"> I know that there is a limit for the number of request (10/s or 1000/100s), but I have tried the exponential backoff suggested by the Google Drive API to handle this error. Even after 248s it still raises the same error. Here an example what I am doing def MoveToFolder(self,files,folder_id,drive): total_files = len(files) for cont in range(total_files): success = False n=0 while

bq.py Not Paging Results

為{幸葍}努か 提交于 2019-12-04 07:38:43
We're working on writing a wrapper for bq.py and are having some problems with result sets larger than 100k rows. It seems like in the past this has worked fine (we had related problems with Google BigQuery Incomplete Query Replies on Odd Attempts ). Perhaps I'm not understanding the limits explained on the doc page ? For instance: #!/bin/bash for i in `seq 99999 100002`; do bq query -q --nouse_cache --max_rows 99999999 "SELECT id, FROM [publicdata:samples.wikipedia] LIMIT $i" > $i.txt j=$(cat $i.txt | wc -l) echo "Limit $i Returned $j Rows" done Yields (note there are 4 lines of formatting):

Google Oauth2.0 web application's “Authorized redirect URIs” must end with a public top-level domain (such as .com or .org)?

天大地大妈咪最大 提交于 2019-12-04 04:26:12
When create a Google API Oauth2.0 Credentials on Google Developers Console , I choose "Web Application" Application type. In the "Authorized redirect URIs" field, I can use http://127.0.0.1/callback , it work fine for me on local development. but when I want to use Google API Oauth2.0 Credentials on my server(let's say 99.99.99.99), I have to use http://99.99.99.99/callback as my "Authorized redirect URIs", but google give me a warning: Invalid Redirect: http://99.99.99.99/callback must end with a public top-level domain (such as .com or .org) Except to bind a public top-level domain to my

How to query an advanced search with google customsearch API?

六月ゝ 毕业季﹏ 提交于 2019-12-03 11:53:33
问题 How can I programmatically using the Google Python client library do an advanced search with Google custom search API search engine in order to return a list of first n links based in some terms and parameters of an advanced search I queried?. I tried to check the documentation(I did not found any example), and this answer. However, the latter did not worked, since currently there is no support for the AJAX API. So far I tried this: from googleapiclient.discovery import build import pprint my

Google Calendar API - Access own calendar via Service account

喜夏-厌秋 提交于 2019-12-03 09:56:03
问题 I want to access the Google Calendar API to insert entries with Python. I created a Service account on the Google API console, added an private key, downloaded it. But when I try to modify anyting of my calendar, it is on the same account, I get the following error message. Reading works. Code is import httplib2 from oauth2client.client import SignedJwtAssertionCredentials from apiclient.discovery import build event = { 'summary' : 'Appointment', 'location' : 'Somewhere', 'start' : {

How to upload csv file (and use it) from google drive into google colaboratory

时光毁灭记忆、已成空白 提交于 2019-12-03 07:24:43
问题 Wanted to try out python, and google colaboratory seemed the easiest option.I have some files in my google drive, and wanted to upload them into google colaboratory. so here is the code that i am using: !pip install -U -q PyDrive from pydrive.auth import GoogleAuth from pydrive.drive import GoogleDrive from google.colab import auth from oauth2client.client import GoogleCredentials # 1. Authenticate and create the PyDrive client. auth.authenticate_user() gauth = GoogleAuth() gauth.credentials

Google Calendar API - Access own calendar via Service account

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-03 00:27:04
I want to access the Google Calendar API to insert entries with Python. I created a Service account on the Google API console, added an private key, downloaded it. But when I try to modify anyting of my calendar, it is on the same account, I get the following error message. Reading works. Code is import httplib2 from oauth2client.client import SignedJwtAssertionCredentials from apiclient.discovery import build event = { 'summary' : 'Appointment', 'location' : 'Somewhere', 'start' : { 'dateTime' : '2012-09-03T10:00:00.000-07:00' }, 'end' : { 'dateTime' : '2012-09-03T10:25:00.000-07:00' } } f =

How to upload csv file (and use it) from google drive into google colaboratory

对着背影说爱祢 提交于 2019-12-02 20:55:08
Wanted to try out python, and google colaboratory seemed the easiest option.I have some files in my google drive, and wanted to upload them into google colaboratory. so here is the code that i am using: !pip install -U -q PyDrive from pydrive.auth import GoogleAuth from pydrive.drive import GoogleDrive from google.colab import auth from oauth2client.client import GoogleCredentials # 1. Authenticate and create the PyDrive client. auth.authenticate_user() gauth = GoogleAuth() gauth.credentials = GoogleCredentials.get_application_default() drive = GoogleDrive(gauth) # 2. Create & upload a file

Pandas GenericGBQException

為{幸葍}努か 提交于 2019-12-02 10:33:21
I'm trying to use try/except to query BigQuery tables, sometimes the query may not be correct in which case pandas raises a GenericGBQException error. My problem is I get name 'GenericGBQException' is not defined when trying to handle this error, example code below: try: df = pd.read_gbq(query, projID) query_fail = 0 except GenericGBQException: query_fail = 1 if query_fail == 1: do some stuff I can get by with catching all exceptions though obviously it's not ideal. I suspect you want to catch pd.GenericGBQException . (Or perhaps gbq.GenericGBQException -- it depends on your imports. Are you

How can I access user info on a domain without the domain administrator enabling API access?

穿精又带淫゛_ 提交于 2019-12-02 03:46:20
问题 I have written an application that I have listed in the Google Marketplace. I am trying to get my app to use the Directory API (part of the Admin SDK). According to the documentation here: https://developers.google.com/admin-sdk/directory/v1/guides/prerequisites, this will require anyone who installs my app to enable API access. The only scope I need is: https://www.googleapis.com/auth/admin.directory.user.readonly Is there any way to access the above scope without requiring API access to be