Timeout error when trying to connect to the gmail api

Ouverte
#161 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Évaluation

Difficulté
3/5
Temps estimé
Une demi-journée
Accessibilité débutants
22/100
Type d'issue
Bug
Clarté
Plutôt claire
Activité
À l'abandon
Stack technique
python
Domaine
api, networking

Piste de recherche

The failure happens in quickstart.py at the build('gmail', 'v1', credentials=creds) call, which fetches the discovery document inside googleapiclient's _retrieve_discovery_doc before any token is written. Start by running the quickstart on a machine with a known-good network path to confirm whether the timeout reproduces, then check whether the discovery URL is reachable. Done means either a reproducible cause is documented, or the sample gets a clearer error or retry path. The thread has no maintainer reply, so confirm the scope with a maintainer first.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

Expected Behavior

quickstart.py should work as intended, showing the user's labels as queried from the user's gmail account.

Actual Behavior

timeout error before creating the token.pickle file:

Traceback (most recent call last):
  File "quickstart.py", line 48, in <module>
    main()
  File "quickstart.py", line 34, in main
    service = build('gmail', 'v1', credentials=creds)
  File "/home/my_username/.pyenv/versions/3.6.4/lib/python3.6/site-packages/googleapiclient/_helpers.py", line 130, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/home/my_username/.pyenv/versions/3.6.4/lib/python3.6/site-packages/googleapiclient/discovery.py", line 224, in build
    requested_url, discovery_http, cache_discovery, cache, developerKey)
  File "/home/my_username/.pyenv/versions/3.6.4/lib/python3.6/site-packages/googleapiclient/discovery.py", line 274, in _retrieve_discovery_doc
    resp, content = http.request(actual_url)
  File "/home/my_username/.pyenv/versions/3.6.4/lib/python3.6/site-packages/httplib2/__init__.py", line 1994, in request
    cachekey,
  File "/home/my_username/.pyenv/versions/3.6.4/lib/python3.6/site-packages/httplib2/__init__.py", line 1651, in _request
    conn, request_uri, method, body, headers
  File "/home/my_username/.pyenv/versions/3.6.4/lib/python3.6/site-packages/httplib2/__init__.py", line 1557, in _conn_request
    conn.connect()
  File "/home/my_username/.pyenv/versions/3.6.4/lib/python3.6/site-packages/httplib2/__init__.py", line 1324, in connect
    sock.connect((self.host, self.port))
socket.timeout: timed out

I tried with both of my system's python versions as well (2.7.17, 3.7.6), same error. I have reasons to believe it's something about my system, since it happens for three different python versions, I tested Java's quickstart code with the same credentials and it worked as expected, and python's version was working until last week, but don't know where to look to fix it, so, any help will be appreciated.

Steps to Reproduce the Problem

  1. Create a virtual env with python 3.6.4.
  2. Run python quickstart.py

Specifications

  • Python version (python --version) 2.7.17, 3.6.4, 3.7.6
  • OS (Mac/Linux/Windows) Linux Fedora 30
Langage dominant
Python
Étoiles
1.4k
Forks
917
Merge moyen
3 min
PR mergées (30 j)
1

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de googleworkspace/python-samples

Toutes les issues de googleworkspace/python-samples

Issues similaires

Plus d'issues Python

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.