From 7eced454d10d2c2b4eb3c0b7da86083347cfb1de Mon Sep 17 00:00:00 2001 From: lakshyacis Date: Tue, 3 Sep 2019 19:56:59 +0530 Subject: [PATCH] http flake8 fixes --- src/network/http.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/network/http.py b/src/network/http.py index 55cb81a1..8bab0c92 100644 --- a/src/network/http.py +++ b/src/network/http.py @@ -2,11 +2,13 @@ import socket from advanceddispatcher import AdvancedDispatcher import asyncore_pollchoose as asyncore -from proxy import Proxy, ProxyError, GeneralProxyError -from socks5 import Socks5Connection, Socks5Resolver, Socks5AuthError, Socks5Error -from socks4a import Socks4aConnection, Socks4aResolver, Socks4aError +from proxy import ProxyError +from socks5 import Socks5Connection, Socks5Resolver +from socks4a import Socks4aConnection, Socks4aResolver -class HttpError(ProxyError): pass + +class HttpError(ProxyError): + pass class HttpConnection(AdvancedDispatcher): @@ -19,8 +21,10 @@ class HttpConnection(AdvancedDispatcher): print "connecting in background to %s:%i" % (self.destination[0], self.destination[1]) def state_init(self): - self.append_write_buf("GET %s HTTP/1.1\r\nHost: %s\r\nConnection: close\r\n\r\n" % (self.path, self.destination[0])) - print "Sending %ib" % (len(self.write_buf)) + self.append_write_buf( + "GET %s HTTP/1.1\r\nHost: %s\r\nConnection: close\r\n\r\n" % ( + self.path, self.destination[0])) + print "Sending %ib" % (len(self.write_buf)) self.set_state("http_request_sent", 0) return False @@ -72,15 +76,15 @@ if __name__ == "__main__": for host in ("bitmessage.org",): direct = HttpConnection(host) while len(asyncore.socket_map) > 0: -# print "loop, state = %s" % (direct.state) + # print "loop, state = %s" % (direct.state) asyncore.loop(timeout=1, count=1) proxy = Socks5HttpConnection(host) while len(asyncore.socket_map) > 0: -# print "loop, state = %s" % (proxy.state) + # print "loop, state = %s" % (proxy.state) asyncore.loop(timeout=1, count=1) proxy = Socks4aHttpConnection(host) while len(asyncore.socket_map) > 0: -# print "loop, state = %s" % (proxy.state) + # print "loop, state = %s" % (proxy.state) asyncore.loop(timeout=1, count=1)