Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Make it clear that CacheControl is a function that mounts an adapter

Aperta
#199 0 commenti 3 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
python
Ambito
networking

Direzione di ricerca

Inizia dalla funzione CacheControl e verifica come monta un HTTPAdapter sulla sessione per i prefissi http:// e https://. Determina se è previsto il cambiamento di denominazione dell’API richiesto o un avviso di sovrascrittura, quindi verifica che il comportamento scelto renda esplicita la sostituzione dell’adapter.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

The camel-case notation suggests that CacheControl is a class. Given the docs terminology, according to which CacheControl is a "wrapper", I expect that CacheControl returns an object that wraps a session.

But CacheControl is neither a class nor it returns a wrapper object. It's a function which mounts an HTTPAdapter to the session and returns the session itself. It's a function with side-effects that could even return None.

My problem with it is that it's not even innocently misleading, because if the user has already mounted an HTTPAdapter for "http://" and "https://", CacheControl will overwrite that adapter without the user even realizing what happened because he/she was convinced by the naming convention and the docs that CacheControl is a wrapper.

Consider:

  • switching to a name that reflects what's actually happening, e.g. mount_cache_adapter;
  • warning the user that any eventual adapter for those prefixes will be overwritten.
Lingua principale
Python
Stelle
505
Fork
153
Merge medio
5g 6h
PR unite (30g)
5

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di psf/cachecontrol

Tutte le issue di psf/cachecontrol

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.