github3.py
github3.py copied to clipboard
No way to easily access the X-Poll-Interval response header for notifications
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.