Google Sheets API HttpError 500 and 503
<p>Edit: solved, the issue was on Google's side. Occurs when requesting a sheet which had diagrams that had invalid intervals in them. Reported bug to Google.</p>

<p>Note: This issue has persisted for more than 2 days. I had it previously but it was automatically resolved after waiting a day. It has since rearisen.</p>

<p>I am currently using the Google Sheets API through Google's python api client. The authentication is OAuth2.0 and I did not change anything significant in my codebase but all of the sudden I am getting 100% error ratio, and it seems like it should be on Google's end. I fear that I am banned from using the API indefinitely, is this the case? My guess is that when I launched the script and immediately cancelled it with ctrl+c because I wanted to run a new version of it caused some issues.</p>

<p>I tried creating another project and using its credentials to make the request and got the same error. Tried having my friend run the script authenticating through his google account and he receives the same error. The independent <a href="http://pastebin.com/PHgpRmHe" rel="nofollow">source code can be found here</a> </p>

<p>About the source code: The get_credentials() (and therefore the authentication) is entirely copied from Google's python quickstart script as seen here <a href="https://developers.google.com/sheets/quickstart/python" rel="nofollow">https://developers.google.com/sheets/quickstart/python</a>.</p>

<p>Tracebacks:</p>

<pre><code>Traceback (most recent call last):
  File "Google_sheets.py", line 164, in &lt;module&gt;
    ss=Spreadsheet(SPREADSHEET_ID)
  File "Google_sheets.py", line 83, in __init__
    spreadsheetId=self.ssId, includeGridData=True).execute()['sheets']}
  File "C:\Users\Larsson\AppData\Local\Programs\Python\Python35-32\lib\site-packages\oauth2client\util.py", line 137, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "C:\Users\Larsson\AppData\Local\Programs\Python\Python35-32\lib\site-packages\googleapiclient\http.py", line 838, in execute
    raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: &lt;HttpError 500 when requesting https://sheets.googleapis.com/v4/spreadsheets/12YdppOoZUNZxhXvcY_cRgfXEfRnR_izlBsF8Sin3rw4?alt=json&amp;includeGridData=true returned "Internal error encountered."&gt;
</code></pre>

<p>After retrying shortly after, I get another error:</p>

<pre><code>Traceback (most recent call last):
  File "Google_sheets.py", line 164, in &lt;module&gt;
    ss=Spreadsheet(SPREADSHEET_ID)
  File "Google_sheets.py", line 83, in __init__
    spreadsheetId=self.ssId, includeGridData=True).execute()['sheets']}
  File "C:\Users\Larsson\AppData\Local\Programs\Python\Python35-32\lib\site-packages\oauth2client\util.py", line 137, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "C:\Users\Larsson\AppData\Local\Programs\Python\Python35-32\lib\site-packages\googleapiclient\http.py", line 838, in execute
    raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: &lt;HttpError 503 when requesting https://sheets.googleapis.com/v4/spreadsheets/12YdppOoZUNZxhXvcY_cRgfXEfRnR_izlBsF8Sin3rw4?includeGridData=true&amp;alt=json returned "The service is currently unavailable."&gt;
</code></pre>

<p>500 and 503 are Google Server issues.  You will need to implement exponential backoff so that you can retry the transaction again.  Check this link - <a href="https://developers.google.com/admin-sdk/directory/v1/limits" rel="nofollow">https://developers.google.com/admin-sdk/directory/v1/limits</a></p>

<p>And, there is a usage limit for all APIs.  Check out this link - <a href="https://developers.google.com/gmail/api/v1/reference/quota" rel="nofollow">https://developers.google.com/gmail/api/v1/reference/quota</a></p>

python google-spreadsheet google-api google-api-client google-sheets-api