nameko.web.server

Attributes

Classes

HttpOnlyProtocol

This class is used to handle the HTTP requests that arrive

WebServer

一个 SharedExtension,用于包装 WSGI 接口以处理 HTTP 请求。

WsgiApp

Functions

parse_address(address_string)

Module Contents

nameko.web.server.STATE_IDLE[源代码]
nameko.web.server.BindAddress[源代码]
nameko.web.server.parse_address(address_string)[源代码]
class nameko.web.server.HttpOnlyProtocol(conn_state, server)[源代码]

Bases: eventlet.wsgi.HttpProtocol

This class is used to handle the HTTP requests that arrive at the server.

The handler will parse the request and the headers, then call a method specific to the request type.

参数:
  • conn_state -- The given connection status.

  • server -- The server accessible by the request handler.

finish()[源代码]
class nameko.web.server.WebServer[源代码]

Bases: nameko.extensions.ProviderCollector, nameko.extensions.SharedExtension

一个 SharedExtension,用于包装 WSGI 接口以处理 HTTP 请求。

WebServer 可以被子类化,通过重写 get_wsgi_serverget_wsgi_app 方法来添加额外的 WSGI 功能。

_gt = None[源代码]
_sock = None[源代码]
_serv = None[源代码]
_starting = False[源代码]
_is_accepting = True[源代码]
property bind_addr[源代码]
run()[源代码]
process_request(sock, address)[源代码]
start()[源代码]

在容器成功启动时调用绑定的扩展。

此方法仅在所有其他扩展成功返回 Extension.setup 后被调用。如果扩展对外部事件做出反应,它现在应该开始对此进行响应。

get_wsgi_app()[源代码]

获取用于处理请求的 WSGI 应用程序。

此方法可以被重写,以应用 WSGI 中间件或完全替换 WSGI 应用程序。

get_wsgi_server(sock, wsgi_app, protocol=HttpOnlyProtocol, debug=False)[源代码]

Get the WSGI server used to process requests.

stop()[源代码]

使用 ProviderCollector 作为混入类的子类的默认 :meth:Extension.stop() 实现。

make_url_map()[源代码]
context_data_from_headers(request)[源代码]
class nameko.web.server.WsgiApp(server)[源代码]

Bases: object

server[源代码]
url_map[源代码]
__call__(environ, start_response)[源代码]