I am trying to write a program that fetches some info from the GitHub API. As part of that I would like to access the response headers returned from the GitHub server (particularly the ETAG header for caching/request limits). How is that possible in MicroPython?
So far I have tried using the `urequests` lib which does not seem to support response headers. Is there better way/alternative lib to use? Thanks
Code: Select all
import urequests
url = "https://api.github.com/repos/someorga/somerepo/issues/events?per_page=1&page=0"
headers = {
"User-Agent": "MicroPython",
"Authorization": "token abc123",
}
response = urequests.get(url, headers=headers)
print(response.headers)