Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

Feature Request: Add Configurable Network Timeouts to HTTP Clients

Aberta
#18 0 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
1-2 dias
Facilidade para iniciantes
56/100
Tipo de issue
Funcionalidade
Clareza
Claramente especificada
Status de atividade
Pouca atividade
Stack de tecnologia
python

Direção de pesquisa

Start by locating the initialization methods for Client, AsyncClient, OauthClient, and AsyncOauthClient, then check how they construct or accept httpx clients. Trace the existing README.md examples and project tests for custom client behavior. Done means all four clients support the documented timeout setting, custom httpx client settings remain intact, and the updated examples are included.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

The Problem

By default, the underlying httpx HTTP library used by this SDK applies a strict 5-second timeout to all network requests.

If an API method takes longer than 5 seconds to process-for example, generating a large PDF file, querying a heavy dataset, or doing operations over a slow network connection-the SDK will unexpectedly crash with a TimeoutException.

Currently, the only way for developers to fix this is to understand how httpx works underneath, build a custom httpx.Client() object with a custom timeout, and explicitly pass it into our SDK upon initialization. This is a bit too much boilerplate work for such a common requirement.

Proposed Solution

We should add a built-in timeout parameter directly into the initialization methods of all our clients (Client, AsyncClient, OauthClient, and AsyncOauthClient), giving it a safer default limit of 30.0 seconds.

Expected behavior:

# Before: Developers had to do all this
import httpx
custom_client = httpx.Client(timeout=60.0)
client = Client(token="abc", client=custom_client)

# After: Simple, clean SDK syntax
client = Client(token="abc", timeout=60.0)
Acceptance Criteria
  • Add timeout: float = 30.0 to Client and AsyncClient.
  • Add timeout: float = 30.0 to OauthClient and AsyncOauthClient.
  • Pass this parameter into the underlying httpx client natively.
  • Ensure full backward compatibility—if a user manually passes a custom httpx client, their settings are preserved and not overridden.
  • Update README.md and PyPI docs with code examples showing how to configure the timeout.
  • Verify all existing unit tests pass cleanly.
Why this matters / Benefits
  • Smarter Defaults: Bumping the default timeout from 5 to 30 seconds prevents the SDK from crashing during heavier, perfectly valid API workloads.
  • Better Developer Experience (DX): Allows users to configure timeouts cleanly in one line of code without needing to learn the intricacies of the underlying httpx library.
Linguagem predominante
Python
Estrelas
18
Forks
4
Métricas de merge de PRs
Nenhum PR com merge em 30d

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de openapi/openapi-python-sdk

Todas as issues de openapi/openapi-python-sdk

Issues semelhantes

Mais issues de Python

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.