Improve documentation
This commit is contained in:
@@ -1,10 +1,7 @@
|
||||
import logging
|
||||
import socket
|
||||
from io import BufferedReader
|
||||
from typing import Tuple
|
||||
|
||||
from httplib.exceptions import BadRequest
|
||||
|
||||
BUFSIZE = 4096
|
||||
TIMEOUT = 3
|
||||
FORMAT = "UTF-8"
|
||||
@@ -12,13 +9,20 @@ MAXLINE = 4096
|
||||
|
||||
|
||||
class HTTPSocket:
|
||||
host: str
|
||||
"""
|
||||
Wrapper class for a socket. Represents an HTTP connection.
|
||||
|
||||
This class adds helper methods to read the underlying socket as a file.
|
||||
"""
|
||||
conn: socket.socket
|
||||
file: Tuple[BufferedReader, None]
|
||||
file: BufferedReader
|
||||
|
||||
def __init__(self, conn: socket.socket, host: str):
|
||||
def __init__(self, conn: socket.socket):
|
||||
"""
|
||||
Initialize an HTTPSocket with the given socket and host.
|
||||
@param conn: the socket object
|
||||
"""
|
||||
|
||||
self.host = host
|
||||
self.conn = conn
|
||||
self.conn.settimeout(TIMEOUT)
|
||||
self.conn.setblocking(True)
|
||||
|
Reference in New Issue
Block a user