yanyongyu / githubkit

The modern, all-batteries-included GitHub SDK for Python, including rest api, graphql, webhooks, like octokit!
https://yanyongyu.github.io/githubkit/
MIT License
177 stars 25 forks source link

Feature: Support custom headers #29

Closed zegl closed 1 year ago

zegl commented 1 year ago

Hey!

Many GitHub endpoints for events, including list_public_events, list_events_for_timeline, list_events, list_events_for_authenticated_user supports ETag and If-None-Match headers (see docs).

I think that it would be convenient if githubkit would support setting the If-None-Match header, and correct parsing of 304 Not Modified responses, as this is currently not possible with the generated methods.

yanyongyu commented 1 year ago

I see.. I may try to add a headers keyword argument to client methods if there is no field named headers.

For the 304 Not Modified, currently is treated as successful response, and the return code is in the reponse object response.status_code. we could restrict the response status code checking to raise an exception. But, should we raise an exception for 304? or we could make a successful status code response model mapping?

yanyongyu commented 1 year ago

headers now can be customed in client request as a keyword only param. I will publish a release later. :)

zegl commented 1 year ago

Amazing! This looks great! ⭐️