Files
nucleus/src/nucleus/domains/http/models/response.py
T
RemiZOffAlex 28d5aae79a
Тестирование ядра / Tester (push) Failing after 3s
Обновить src/nucleus/domains/http/models/response.py
2026-06-18 14:02:47 +03:00

30 lines
741 B
Python

__author__ = 'RemiZOffAlex'
__email__ = 'remizoffalex@mail.ru'
class Response:
def __init__(self, data, **kwargs):
self.code = 200
self.phrase = 'Success'
self.version = 'HTTP/1.1'
self.headers = {}
self.content_type = "text/plain"
self.__data = data
for key in kwargs:
if key in self.__dict__:
setattr(self, key, kwargs[key])
def __call__(self):
status = ' '.join([self.version, str(self.code), self.phrase])
crlf = b'\r\n'*2
raw = crlf.join([
status.encode(),
self.__data.encode()
])
return raw
def __getitem__(self, index):
pass
def __iter__(self):
pass