Google API発行時にエラーになる
re3turn opened this issue · comments
re3turn commented
herokuで実行していると時々 Connection timed out
や Payload must not be empty
でエラーになる
twicrawler/app/google_photos.py
Line 78 in 2be25ef
Traceback (most recent call last):
File "/app/app/crawler.py", line 35, in upload_google_photos
self.google_photos.upload_media(media_path, description)
File "/app/app/google_photos.py", line 85, in upload_media
upload_token = self._execute_upload_api(data=file_data, upload_file_name=os.path.basename(file_path))
File "</app/.heroku/python/lib/python3.7/site-packages/decorator.py:decorator-gen-4>", line 2, in _execute_upload_api
File "/app/.heroku/python/lib/python3.7/site-packages/retry/api.py", line 74, in retry_decorator
logger)
File "/app/.heroku/python/lib/python3.7/site-packages/retry/api.py", line 33, in __retry_internal
return f()
File "/app/app/google_photos.py", line 78, in _execute_upload_api
(response, upload_token) = self.authorized_http.request(uri=UPLOAD_API_URL, method='POST', body=data, headers=headers)
File "/app/.heroku/python/lib/python3.7/site-packages/google_auth_httplib2.py", line 198, in request
uri, method, body=body, headers=request_headers, **kwargs)
File "/app/.heroku/python/lib/python3.7/site-packages/httplib2/__init__.py", line 1957, in request
cachekey,
File "/app/.heroku/python/lib/python3.7/site-packages/httplib2/__init__.py", line 1622, in _request
conn, request_uri, method, body, headers
File "/app/.heroku/python/lib/python3.7/site-packages/httplib2/__init__.py", line 1529, in _conn_request
conn.request(method, request_uri, body, headers)
File "/app/.heroku/python/lib/python3.7/http/client.py", line 1244, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/app/.heroku/python/lib/python3.7/http/client.py", line 1290, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/app/.heroku/python/lib/python3.7/http/client.py", line 1239, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/app/.heroku/python/lib/python3.7/http/client.py", line 1065, in _send_output
self.send(chunk)
File "/app/.heroku/python/lib/python3.7/http/client.py", line 987, in send
self.sock.sendall(data)
File "/app/.heroku/python/lib/python3.7/ssl.py", line 1034, in sendall
v = self.send(byte_view[count:])
File "/app/.heroku/python/lib/python3.7/ssl.py", line 1003, in send
return self._sslobj.write(data)
TimeoutError: [Errno 110] Connection timed out
Traceback (most recent call last):
File "/app/app/crawler.py", line 35, in upload_google_photos
self.google_photos.upload_media(media_path, description)
File "/app/app/google_photos.py", line 85, in upload_media
upload_token = self._execute_upload_api(data=file_data, upload_file_name=os.path.basename(file_path))
File "</app/.heroku/python/lib/python3.7/site-packages/decorator.py:decorator-gen-4>", line 2, in _execute_upload_api
File "/app/.heroku/python/lib/python3.7/site-packages/retry/api.py", line 74, in retry_decorator
logger)
File "/app/.heroku/python/lib/python3.7/site-packages/retry/api.py", line 33, in __retry_internal
return f()
File "/app/app/google_photos.py", line 80, in _execute_upload_api
raise GoogleApiResponseNG(f'Google API response NG, content={upload_token}')
app.google_photos.GoogleApiResponseNG: Google API response NG, content=b'{\n "code": 3,\n "message": "Payload must not be empty"\n}'