Note that there are some explanatory texts on larger screens.

plurals
  1. POGoogle Mirror API throwing BadStatusLine exception (Python)
    primarykey
    data
    text
    <p>When using the Mirror API, I randomly get a "BadStatusLine" exception from several API calls, including timeline().insert and timeline.list. From trolling around SO for simliar problems in python, I suspect this is some kind of malformed response from the server.</p> <p>It seems to happen randomly and possibly after a period of not using the API. Here's a sample stack trace:</p> <pre><code> Traceback (most recent call last): File "service.py", line 61, in receive_message self.process_user_chat(msg) File "service.py", line 304, in process_user_chat self.upsert_timeline_item(sourceItemId, body) File "service.py", line 86, in upsert_timeline_item new_item = self.glass_service.timeline().insert(body=body).execute() File "/usr/local/lib/python2.7/dist-packages/oauth2client/util.py", line 128, in positional_wrapper return wrapped(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/apiclient/http.py", line 676, in execute body=self.body, headers=self.headers) File "/usr/local/lib/python2.7/dist-packages/oauth2client/util.py", line 128, in positional_wrapper return wrapped(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/oauth2client/client.py", line 494, in new_request self._refresh(request_orig) File "/usr/local/lib/python2.7/dist-packages/oauth2client/client.py", line 653, in _refresh self._do_refresh_request(http_request) File "/usr/local/lib/python2.7/dist-packages/oauth2client/client.py", line 682, in _do_refresh_request self.token_uri, method='POST', body=body, headers=headers) File "/usr/local/lib/python2.7/dist-packages/httplib2/__init__.py", line 1570, in request (response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey) File "/usr/local/lib/python2.7/dist-packages/httplib2/__init__.py", line 1317, in _request (response, content) = self._conn_request(conn, request_uri, method, body, headers) File "/usr/local/lib/python2.7/dist-packages/httplib2/__init__.py", line 1286, in _conn_request response = conn.getresponse() File "/usr/lib/python2.7/httplib.py", line 1034, in getresponse response.begin() File "/usr/lib/python2.7/httplib.py", line 407, in begin version, status, reason = self._read_status() File "/usr/lib/python2.7/httplib.py", line 371, in _read_status raise BadStatusLine(line) BadStatusLine: '' </code></pre> <p>This code works most of the time, but every once in a while I get a response like this.</p> <hr> <p><strong>Update:</strong> My code was creating the Google API classes and using them for the duration of the service. Once it got time to renew my oauth2 token (1 hour) I'd get this error once or twice then it would start working again. I was able to refactor my code so it creates the API classes on each request and the problem has gone away. This appears to be a known bug in Google's API, see the selected answer from Anthony Tuininga for more information.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload