https flake8 fixes

This commit is contained in:
lakshyacis 2019-09-06 14:36:51 +05:30
parent 77651eebe3
commit db1593f428
No known key found for this signature in database
GPG Key ID: D2C539C8EC63E9EB

View File

@ -1,10 +1,18 @@
import asyncore import asyncore
from http import HTTPClient from http import HTTPClient
import paths
from tls import TLSHandshake from tls import TLSHandshake
# self.sslSock = ssl.wrap_socket(self.sock, keyfile = os.path.join(paths.codePath(), 'sslkeys', 'key.pem'), certfile = os.path.join(paths.codePath(), 'sslkeys', 'cert.pem'), server_side = not self.initiatedConnection, ssl_version=ssl.PROTOCOL_TLSv1, do_handshake_on_connect=False, ciphers='AECDH-AES256-SHA') """
self.sslSock = ssl.wrap_socket(
self.sock,
keyfile=os.path.join(paths.codePath(), 'sslkeys', 'key.pem'),
certfile=os.path.join(paths.codePath(), 'sslkeys', 'cert.pem'),
server_side=not self.initiatedConnection,
ssl_version=ssl.PROTOCOL_TLSv1,
do_handshake_on_connect=False,
ciphers='AECDH-AES256-SHA')
"""
class HTTPSClient(HTTPClient, TLSHandshake): class HTTPSClient(HTTPClient, TLSHandshake):
@ -12,7 +20,15 @@ class HTTPSClient(HTTPClient, TLSHandshake):
if not hasattr(self, '_map'): if not hasattr(self, '_map'):
asyncore.dispatcher.__init__(self) asyncore.dispatcher.__init__(self)
self.tlsDone = False self.tlsDone = False
# TLSHandshake.__init__(self, address=(host, 443), certfile='/home/shurdeek/src/PyBitmessage/sslsrc/keys/cert.pem', keyfile='/home/shurdeek/src/PyBitmessage/src/sslkeys/key.pem', server_side=False, ciphers='AECDH-AES256-SHA') """
TLSHandshake.__init__(
self,
address=(host, 443),
certfile='/home/shurdeek/src/PyBitmessage/sslsrc/keys/cert.pem',
keyfile='/home/shurdeek/src/PyBitmessage/src/sslkeys/key.pem',
server_side=False,
ciphers='AECDH-AES256-SHA')
"""
HTTPClient.__init__(self, host, path, connect=False) HTTPClient.__init__(self, host, path, connect=False)
TLSHandshake.__init__(self, address=(host, 443), server_side=False) TLSHandshake.__init__(self, address=(host, 443), server_side=False)
@ -49,6 +65,7 @@ class HTTPSClient(HTTPClient, TLSHandshake):
else: else:
TLSHandshake.handle_write(self) TLSHandshake.handle_write(self)
if __name__ == "__main__": if __name__ == "__main__":
client = HTTPSClient('anarchy.economicsofbitcoin.com', '/') client = HTTPSClient('anarchy.economicsofbitcoin.com', '/')
asyncore.loop() asyncore.loop()