Connect Four (183) server responds only with 200 code

Back to General discussions forum

Dan Nagle     2026-01-09 15:29:31

I'm using the following URL as the endpoint for the task.

http://2.59.218.221/connect4.php

When I send the initial request to the server the response is empty.

params = {"token": user_token}
response = requests.post(ENDPOINT, params=params)
print(response.status_code)
print(response.content)

Output:

200
b"error: Can't detect data format\r\n"

Is the URL I'm using correct?

Dan Nagle     2026-02-12 09:37:44

I identified my issue. I was sending the parameters in the URL query string instead of the post body.

Working code:

def server_request(move=None):
    payload = f"token: {USER_TOKEN}"
    if move:
        payload += f"\nmove: {move}"
    return dict(line.split(": ") for line in requests.post(ENDPOINT, data=payload).text.strip().splitlines())
Please login and solve 5 problems to be able to post at forum