google-api-python-client httplib2超时

时间:2018-12-22 09:02:55

标签: python sockets google-python-api

我有一台机器进行测试,Fowlloing代码会很好,但是当我部署到生产服务器时,它将显示超时。

错误:

socket.timeout : timeout

此服务器具有防火墙,但已经允许使用google ip。这个插座会像握把一样吗,还是Google需要将其连接到我的服务器的标准配置?

代码:

from google.oauth2 import service_account
import googleapiclient.discovery
SCOPES = ['https://www.googleapis.com/auth/drive.file', 
'https://www.googleapis.com/auth/drive',
      'https://www.googleapis.com/auth/drive.readonly']
SERVICE_ACCOUNT_FILE = 'client_secret.json'
API_SERVICE_NAME = 'drive'
API_VERSION = 'v3'

credentials = service_account.Credentials.from_service_account_file(
    SERVICE_ACCOUNT_FILE, scopes=SCOPES)
service = googleapiclient.discovery.build(API_SERVICE_NAME, API_VERSION, credentials=credentials)

0 个答案:

没有答案