github3.py icon indicating copy to clipboard operation
github3.py copied to clipboard

No way to easily access the X-Poll-Interval response header for notifications

Open elad661 opened this issue 6 years ago • 0 comments

I want to poll notifications from GitHub, and I want to make sure to adjust my polling interval according to the X-Poll-Interval header in the response.

At the moment, the only way for me to get that value is to do something like:

notifications = gh.notifications()
first_notification = notifications.next()
interval = notifications.last_response.headers['X-Poll-Interval']
for notification in chain([first_notification], notifications):
   # process notifications here

And this is a bit complicated and not very pythoninc. It would be nice if the X-Poll-Interval would be added to the objects returned from the notifications iterator, so accessing it would be simpler.

elad661 avatar Nov 10 '17 17:11 elad661