Interactive problems no longer working?

Back to General discussions forum

johnnycake     2019-08-04 17:11:01

After completing the first interactive problem (say-100),I went on to the second (nim-game) but the server will not recognize a fresh token. Here's the code in Python 3.7:

import requests

d='mB4k4LR67sABxrJ6FbjUdzY5'

response=requests.post('http://open-abbey.appspot.com/interactive/nim-game',data={'token':d})

print(response)

Output is: <Response [200]>

The expected response would be something like:

heaps: 2 3 4

Quandray     2019-08-04 18:39:32
User avatar

It's working for me using C++ and curl. A HTTP 200 response is an "OK". Did you get anything after that?

Rodion (admin)     2019-08-04 18:52:58
User avatar

Hello!

Thanks to Quandray for checking this! Well, since the server probably works, something is probably wrong with your code.

I am still poor at Python and don't remember exactly how we do it in python using requests, but after this hint I've looked at your code for Say-100 - and here is slight difference:

Instead of:

response=requests.post
print(response)

You wrote:

response=requests.post
print(response.text)
#             ^^^^^

I guess the response is object and you need to take the field .text?

johnnycake     2019-08-05 00:18:37

Thank you, Rodion. You are correct. I must have been a little sloppy when copying my code.

print(response) returns only the status code

print(response.text) returns the status code and content

It's working for me now.

Please login and solve 5 problems to be able to post at forum