Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getheaders() returns uppercase headers in python3 and lowercase in python2 #67

Open
gene1wood opened this issue Oct 7, 2019 · 0 comments

Comments

@gene1wood
Copy link
Collaborator

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']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant