3333"""
3434from telnetlib import Telnet
3535from threading import Thread
36- from httplib import HTTPConnection
37- from urlparse import urlparse
36+ from http . client import HTTPConnection
37+ from urllib . parse import urlparse
3838from hashlib import sha256
3939import logging
4040
@@ -64,7 +64,7 @@ def http_purge_url(url):
6464
6565class VarnishHandler (Telnet ):
6666 def __init__ (self , host_port_timeout , secret = None , ** kwargs ):
67- if isinstance (host_port_timeout , basestring ):
67+ if isinstance (host_port_timeout , str ):
6868 host_port_timeout = host_port_timeout .split (':' )
6969 Telnet .__init__ (self , * host_port_timeout )
7070 (status , length ), content = self ._read ()
@@ -74,7 +74,7 @@ def __init__(self, host_port_timeout, secret=None, **kwargs):
7474 logging .error ('Connecting failed with status: %i' % status )
7575
7676 def _read (self ):
77- (status , length ), content = map (int , self .read_until ('\n ' ).split ()), ''
77+ (status , length ), content = list ( map (int , self .read_until ('\n ' ).split () )), ''
7878 while len (content ) < length :
7979 content += self .read_some ()
8080 return (status , length ), content [:- 1 ]
@@ -90,7 +90,7 @@ def fetch(self, command):
9090 buffer = self .read_until ('\n ' ).strip ()
9191 if len (buffer ):
9292 break
93- status , length = map (int , buffer .split ())
93+ status , length = list ( map (int , buffer .split () ))
9494 content = ''
9595
9696 if status != 200 :
0 commit comments