Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Доп. задача #1

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Доп. задача #1

wants to merge 9 commits into from

Conversation

iffomko
Copy link
Collaborator

@iffomko iffomko commented May 12, 2023

No description provided.

… данных на клиенте. Если это был GET запрос, то в ответе присылается код ответа и количество вхождений под строчки в строку с результатом от сервера. В остальных случаях просто возвращает ответ от сервера. Также для клиента добавил формочку, которая запрашивает эту строчку, если выбрана кнопка GET запроса
client/http_client.py Outdated Show resolved Hide resolved
server/server.py Outdated
if not HttpServer.validate_body(settings):
response = HttpServer.create_bad_request_response(
origin,
'Вы не ввели либо url, либо тип запроса'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

а давай писать чего именно недостает - а то чот ка кто непонятненько

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Переделал. Теперь возвращаются понятные сообщения от валидации

server/server.py Outdated

client_data = client.get_data()
if client_data == 'Неправильный url адрес или port':

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

мммммммммм, хардкод строк, вкусно

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Добавил все в енамы

server/server.py Outdated

response = self.create_response(client_data, origin)
conn.sendall(response.encode())
if settings.get('request').lower() == 'get' and len(settings.get('get_form')) != 0:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

уверен, что именно так надо сравнивать?)))

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вынес все в енамы

server/server.py Outdated
Comment on lines 102 to 107
if \
body.get('url') is None or \
body.get('request') is None or \
type(body.get('cookie')) != dict or \
type(body.get('headers')) != dict or \
type(body.get('body')) != str:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

а давай условие в скобки занесем, и не будем такие переносы делать?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Сделал несколько отдельных if для этого

server/server.py Outdated
if \
body.get('url') is None or \
body.get('request') is None or \
type(body.get('cookie')) != dict or \

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

а еще типы сравнивают как isinstance а не чеканьем типов от type)))

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Поменял на isinstance

server/server.py Outdated
"""

if \
body.get('url') is None or \

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
body.get('url') is None or \
not body.get('url') or

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants