17 lines
414 B
Python
17 lines
414 B
Python
import socket
|
|
|
|
from httplib.httpsocket import HTTPSocket, InvalidResponse
|
|
|
|
|
|
class HTTPClient(HTTPSocket):
|
|
host: str
|
|
|
|
def __init__(self, host: str):
|
|
super().__init__(socket.socket(socket.AF_INET, socket.SOCK_STREAM), host)
|
|
|
|
def read_line(self):
|
|
try:
|
|
return super().read_line()
|
|
except UnicodeDecodeError:
|
|
raise InvalidResponse("Unexpected decoding error")
|