feat(json_client): headers param on JsonClient.get — If-None-Match → 304 conditional reads

Offen
#165 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
48/100
Issue-Typ
Feature
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
python

Rechercherichtung

Start by reading campus_python/json_client/interface.py and trace JsonClient.get through its concrete implementations and test doubles named in the issue, including CampusRequest. The proposal also mentions Files.get_content, BySlugCollection.get_content, and Files.File.get_content; check their tests before deciding the scope. Done means conditional requests can send If-None-Match and handle 304 as described, with the affected implementations and tests updated.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Deferred from #125 / PR #164: campus.api /files content responses (by-slug and by-id) emit an ETag ({size}-{updated_at}) and honor If-None-Match with 304 Not Modified, but the SDK cannot send conditional requests — JsonClient.get(path, query=None) has no headers parameter.

Proposal

  • Add headers: Mapping[str, str] | None = None to JsonClient.get (and, if wanted, the other verbs) in campus_python/json_client/interface.py.
  • Files.get_content / BySlugCollection.get_content / Files.File.get_content could then accept an etag param: send If-None-Match, and on 304 return None (caller keeps its cached copy) instead of raising.

Why not now

A signature change on the client ABC ripples into every concrete implementation and test double fleet-wide (CampusRequest, the campus-suite TestCampusRequest, nyxchange/classroom/admin doubles). Content responses already carry max-age=60, so plain HTTP-layer caching works today; conditional revalidation is a nice-to-have that deserves its own coordinated change.

Refs: #125, #164, campus#1007 (server ETag semantics).

Vorherrschende Sprache
Python
Sterne
0
Forks
0
Ø Merge
50 Min.
Gemergte PRs (30 T.)
48

Entwicklungsumgebung

In Codespaces öffnen

Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.

  • Kein Dockerfile und keine Docker-Compose-Datei
  • Keine Pull-Request-Vorlage
  • Kein Beitragsleitfaden

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus nyjc-computing/campus-api-python

Alle Issues in nyjc-computing/campus-api-python

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.