Closed Arxcis closed 8 years ago
Here is example of retrieving POST requests in flask: https://github.com/technocake/flask-eksempel/blob/master/webserver.py#L105-L130
I think this issue can be closed. Scores can now be posted to the server and stored, and a list of scores can be returned to the game client.
Fantastic work! :)
Closed #4 https://github.com/EmilZach/Sentence-Crusher/issues/4.
— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/EmilZach/Sentence-Crusher/issues/4#event-604581053
Thanks Robin. By the way, who is Kjell? Are you guys related? If so, greetings from me. Nice to have another man on board :)
oops... thanks arxcis... jonas!
Kjell is just me, using my brothers computer, forgetting to change user-name
Thanks Robin. By the way, who is Kjell? Are you guys related? If so, greetings from me. Nice to have another man on board :)
— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/EmilZach/Sentence-Crusher/issues/4#issuecomment-202127426
Too bad.. would be nice to have your brother on board. Can he program?
Trying to inspire him , but its difficult. He prefers to use games, not make them..
Too bad.. would be nice to have your brother on board. Can he program?
— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/EmilZach/Sentence-Crusher/issues/4#issuecomment-202127789
Perhaps one day he will see the light :)
When a program speaks with a web-application - our game.py and our flask-web-server.py) - it does so with HTTP requests.
There are two main HTTP request types - the HTTP GET method and HTTP POST method. GET is meant for fetching something from the server. A GET request implies that no side effects will happen when the server receives our request. Side effects may be changing something in the database for instance.
To do that, we use the POST request. https://github.com/technocake/flask-eksempel/blob/master/httpclient.py
get_highscore_list()
In the flask webserver, the function get_highscore_list() should return the current list of higscores from the database. It should return this in a format that is good for programs to read, not HTML, preferably text. (maybe JSON). This will be used by the game program to ask the server for the highscore-list and then show this data to the player.
add_higscore(...)
The add_highscore(...) function in the webserver should accept post requests from the game program containing data for a new highscore. [Jonas, can you fill in the details about the data in a game result / highscore? name, time, points. etc]