Response module¶
-
class
message.Response.
Response
(status_code: enum.Enum, body: str, header: dict)¶ Bases:
object
Responsible for encapsulating the response headers and body
-
encodeResponse
() → bytes¶ Responsible for encoding the string representation of the Response class instance
returns: A byte object containing the Response class instance
-
encodeResponseImages
(image: str, new_path: Optional[str] = None) → bytes¶ Responsible for encoding the response along with the image
- Parameters
image – A string containing the image name
new_path – A string containing the new image path if the image was altered
- Returns
A byte object containing the response headers and body along with the image
-
static
getDate
() → str¶ Responsible for creating a string with the current date
- Returns
A string containing the current date
-
static
getDateFromSeconds
(seconds: float) → str¶ Creates a date from the given seconds
- Parameters
seconds – A float number containing the total date in seconds
- Returns
A string containing the date created from the given second
-
headerLine
() → str¶ Responsible for creating a string containing the headers information
- Returns
A string containing the headers information
-
statusLine
()¶ Responsible for creating a string with the protocol and status
- Returns
A string containing the protocol and the status
-