diff --git a/daphne/cli.py b/daphne/cli.py index 7c0c3c9..a036821 100755 --- a/daphne/cli.py +++ b/daphne/cli.py @@ -270,16 +270,16 @@ class CommandLineInterface: websocket_connect_timeout=args.websocket_connect_timeout, websocket_handshake_timeout=args.websocket_connect_timeout, application_close_timeout=args.application_close_timeout, - action_logger=AccessLogGenerator(access_log_stream) - if access_log_stream - else None, + action_logger=( + AccessLogGenerator(access_log_stream) if access_log_stream else None + ), root_path=args.root_path, verbosity=args.verbosity, proxy_forwarded_address_header=self._get_forwarded_host(args=args), proxy_forwarded_port_header=self._get_forwarded_port(args=args), - proxy_forwarded_proto_header="X-Forwarded-Proto" - if args.proxy_headers - else None, + proxy_forwarded_proto_header=( + "X-Forwarded-Proto" if args.proxy_headers else None + ), server_name=args.server_name, ) self.server.run() diff --git a/daphne/http_protocol.py b/daphne/http_protocol.py index b7da1bf..e9eba96 100755 --- a/daphne/http_protocol.py +++ b/daphne/http_protocol.py @@ -286,9 +286,11 @@ class WebRequest(http.Request): "path": uri, "status": self.code, "method": self.method.decode("ascii", "replace"), - "client": "%s:%s" % tuple(self.client_addr) - if self.client_addr - else None, + "client": ( + "%s:%s" % tuple(self.client_addr) + if self.client_addr + else None + ), "time_taken": self.duration(), "size": self.sentLength, }, diff --git a/daphne/ws_protocol.py b/daphne/ws_protocol.py index 184515d..b1e29c3 100755 --- a/daphne/ws_protocol.py +++ b/daphne/ws_protocol.py @@ -115,9 +115,9 @@ class WebSocketProtocol(WebSocketServerProtocol): "connecting", { "path": self.request.path, - "client": "%s:%s" % tuple(self.client_addr) - if self.client_addr - else None, + "client": ( + "%s:%s" % tuple(self.client_addr) if self.client_addr else None + ), }, ) @@ -138,9 +138,9 @@ class WebSocketProtocol(WebSocketServerProtocol): "connected", { "path": self.request.path, - "client": "%s:%s" % tuple(self.client_addr) - if self.client_addr - else None, + "client": ( + "%s:%s" % tuple(self.client_addr) if self.client_addr else None + ), }, ) @@ -175,9 +175,9 @@ class WebSocketProtocol(WebSocketServerProtocol): "disconnected", { "path": self.request.path, - "client": "%s:%s" % tuple(self.client_addr) - if self.client_addr - else None, + "client": ( + "%s:%s" % tuple(self.client_addr) if self.client_addr else None + ), }, ) @@ -242,9 +242,9 @@ class WebSocketProtocol(WebSocketServerProtocol): "rejected", { "path": self.request.path, - "client": "%s:%s" % tuple(self.client_addr) - if self.client_addr - else None, + "client": ( + "%s:%s" % tuple(self.client_addr) if self.client_addr else None + ), }, )