我有一台机器进行测试,folloing代码会很好,但是当我部署到生产服务器时,它会显示超时。
错误:
socket.timeout : timeout
该服务器有防火墙,但已经允许谷歌 IP。这个套接字会像抓握一样,还是标准需要谷歌连接到我的服务器?
代码:
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)