Created
April 15, 2016 19:17
-
-
Save KhorAMus/9071982f3bd03f143a17fdb97795b6f8 to your computer and use it in GitHub Desktop.
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
1-ЫЙ ЗАПРОС | |
Исходный код: | |
from webob import Request, Response | |
environ = { | |
"SERVER_NAME": "httpbin.org", | |
"SERVER_PORT": "80", | |
"PATH_INFO": '/ip', | |
'REQUEST_METHOD': "GET", | |
'SCRIPT_NAME': '', | |
'Accept': '*/*', | |
'wsgi.url_scheme': 'http', | |
'http_version': '1.1' | |
} | |
req = Request(environ) | |
resp = req.get_response() | |
resp.charset = 'utf-8' | |
print(resp) | |
Результат работы: | |
200 OK | |
Server: nginx | |
Date: Fri, 15 Apr 2016 17:43:35 GMT | |
Content-Length: 30 | |
Connection: keep-alive | |
Access-Control-Allow-Origin: * | |
Access-Control-Allow-Credentials: true | |
Content-Type: application/json; charset=utf-8 | |
{ | |
"origin": "5.166.61.78" | |
} | |
2-ОЙ ЗАПРОС |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment