Skip to content

fix: add explicit timeout for httplib2 to prevent connection timeouts#6

Open
alexfazio wants to merge 1 commit intoAadv1k:mainfrom
alexfazio:fix/httplib2-timeout
Open

fix: add explicit timeout for httplib2 to prevent connection timeouts#6
alexfazio wants to merge 1 commit intoAadv1k:mainfrom
alexfazio:fix/httplib2-timeout

Conversation

@alexfazio
Copy link
Copy Markdown

Summary

  • Adds explicit 60-second timeout for httplib2 connections to prevent TimeoutError in embedded Python environments

Problem

When running inside Neovim's Python provider (pynvim), the default httplib2 connection timeout can be too short, causing Google API requests to fail with TimeoutError: timed out before completing.

This manifests as errors like:

File ".../httplib2/__init__.py", line 1159, in connect
    sock.connect((self.host, self.port))
TimeoutError: timed out

Solution

Use google_auth_httplib2.AuthorizedHttp to wrap credentials with a custom httplib2.Http instance that has a 60-second timeout configured.

Test plan

  • Tested with Neovim + pynvim on macOS
  • Verified :Gdoc write successfully creates documents after patch
  • Confirmed API calls work from CLI Python as well

🤖 Generated with Claude Code

When running inside Neovim's Python provider (pynvim), the default
httplib2 connection timeout can be too short, causing API requests
to fail with TimeoutError before completing.

This patch adds an explicit 60-second timeout using AuthorizedHttp,
which resolves connection timeout issues in embedded Python environments.

The change uses google_auth_httplib2.AuthorizedHttp to wrap the
credentials with a custom httplib2.Http instance that has a longer
timeout configured.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant