@@ -117,7 +117,7 @@ def __init__(self, msg, socket_err=None):
117117 self .socket_err = socket_err
118118
119119 if socket_err :
120- self .msg += ": {0 }" .format (socket_err )
120+ self .msg += ": {}" .format (socket_err )
121121
122122 def __str__ (self ):
123123 return self .msg
@@ -586,7 +586,7 @@ def _SOCKS5_request(self, conn, cmd, dst):
586586 if status != 0x00 :
587587 # Connection failed: server returned an error
588588 error = SOCKS5_ERRORS .get (status , "Unknown error" )
589- raise SOCKS5Error ("{0 :#04x}: {1 }" .format (status , error ))
589+ raise SOCKS5Error ("{:#04x}: {}" .format (status , error ))
590590
591591 # Get the bound address/port
592592 bnd = self ._read_SOCKS5_address (reader )
@@ -704,7 +704,7 @@ def _negotiate_SOCKS4(self, dest_addr, dest_port):
704704 if status != 0x5A :
705705 # Connection failed: server returned an error
706706 error = SOCKS4_ERRORS .get (status , "Unknown error" )
707- raise SOCKS4Error ("{0 :#04x}: {1 }" .format (status , error ))
707+ raise SOCKS4Error ("{:#04x}: {}" .format (status , error ))
708708
709709 # Get the bound address/port
710710 self .proxy_sockname = (socket .inet_ntoa (resp [4 :]),
@@ -764,7 +764,7 @@ def _negotiate_HTTP(self, dest_addr, dest_port):
764764 "HTTP proxy server did not return a valid HTTP status" )
765765
766766 if status_code != 200 :
767- error = "{0 }: {1 }" .format (status_code , status_msg )
767+ error = "{}: {}" .format (status_code , status_msg )
768768 if status_code in (400 , 403 , 405 ):
769769 # It's likely that the HTTP proxy server does not support the
770770 # CONNECT tunneling method
@@ -847,10 +847,10 @@ def connect(self, dest_pair, catch_errors=None):
847847 self .close ()
848848 if not catch_errors :
849849 proxy_addr , proxy_port = proxy_addr
850- proxy_server = "{0 }:{1 }" .format (proxy_addr , proxy_port )
850+ proxy_server = "{}:{}" .format (proxy_addr , proxy_port )
851851 printable_type = PRINTABLE_PROXY_TYPES [proxy_type ]
852852
853- msg = "Error connecting to {0 } proxy {1 }" .format (printable_type ,
853+ msg = "Error connecting to {} proxy {}" .format (printable_type ,
854854 proxy_server )
855855 log .debug ("%s due to: %s" , msg , error )
856856 raise ProxyConnectionError (msg , error )
0 commit comments