google-api-python-client httplib2 timeout

575 views Asked by At

I have a machine for test, fowlloing code will be fine, but when I deploye to production server, It will show timeout.

error:

socket.timeout : timeout

this server have firewall, but already allowed google ip. is this socket will do like grip, or something standard needs google connect to my server?

code:

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

There are 0 answers