agithub
agithub copied to clipboard
getheaders() returns uppercase headers in python3 and lowercase in python2
The case of the headers returned differs between Python2 and Python3. This may be due to differences between http.client
and httplib
Python 2
$ python
Python 2.7.15+ (default, Jul 9 2019, 16:51:35)
[GCC 7.4.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from agithub.GitHub import GitHub
>>> g = GitHub()
>>> status, data = g.users.octocat.get()
>>> print([x[0] for x in g.getheaders()])
['content-length', 'vary', 'x-xss-protection', 'x-content-type-options', 'etag', 'cache-control', 'referrer-policy', 'status', 'x-ratelimit-remaining', 'x-github-media-type', 'access-control-expose-headers', 'x-github-request-id', 'last-modified', 'date', 'access-control-allow-origin', 'content-security-policy', 'strict-transport-security', 'server', 'x-ratelimit-limit', 'x-frame-options', 'content-type', 'x-ratelimit-reset']
Python 3
$ python3
Python 3.6.8 (default, Aug 20 2019, 17:12:48)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from agithub.GitHub import GitHub
>>> g = GitHub()
>>> status, data = g.users.octocat.get()
>>> print([x[0] for x in g.getheaders()])
['Date', 'Content-Type', 'Content-Length', 'Server', 'Status', 'X-RateLimit-Limit', 'X-RateLimit-Remaining', 'X-RateLimit-Reset', 'Cache-Control', 'Vary', 'ETag', 'Last-Modified', 'X-GitHub-Media-Type', 'Access-Control-Expose-Headers', 'Access-Control-Allow-Origin', 'Strict-Transport-Security', 'X-Frame-Options', 'X-Content-Type-Options', 'X-XSS-Protection', 'Referrer-Policy', 'Content-Security-Policy', 'Vary', 'X-GitHub-Request-Id']