Last active
August 29, 2015 14:05
-
-
Save mozillazg/36b761f663cfc9fe2b10 to your computer and use it in GitHub Desktop.
web.py return request headers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import json | |
import web | |
urls = ( | |
'/', 'Index', | |
) | |
app = web.application(urls, globals()) | |
class Index(object): | |
def GET(self): | |
headers = web.ctx.env | |
for key in headers.copy(): | |
if 'wsgi' in key: | |
headers.pop(key) | |
body = json.dumps(headers, indent=2) | |
print(body) | |
return body | |
if __name__ == '__main__': | |
web.config.debug = True | |
app.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment