Closed woctezuma closed 5 years ago
The curl
command works after I have replaced this part of the code:
LOG.info("Starting HTTP server...")
http_server = WSGIServer(('', 5000), app)
try:
http_server.serve_forever()
except KeyboardInterrupt:
LOG.info("Exit requested")
worker.close()
with:
LOG.info("Starting HTTP server...")
try:
app.run(host='0.0.0.0') # Reference: https://stackoverflow.com/a/30554831
except KeyboardInterrupt:
LOG.info("Exit requested")
worker.close()
In which case, it is not required to import WSGIServer
anymore.
However, the output differs from the output shown in the README
:
500 Internal Server Error
.(venv) C:\Users\Woctezuma\PycharmProjects\SimpleWebAPI>curl -s 127.0.0.1:5000/ISteamApps/GetProductInfo/?appids=570,730
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>500 Internal Server Error</title>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.</p>
(venv) C:\Users\Woctezuma\PycharmProjects\SimpleWebAPI>curl -s 127.0.0.1:5000/ISteamApps/GetProductChanges/?since_changenumber=2397700
{"current_change_number":5755420,"force_full_app_update":true,"force_full_package_update":true,"since_change_number":2397700}
With a more recent change number, it is fine.
(venv) C:\Users\Woctezuma\PycharmProjects\SimpleWebAPI>curl -s 127.0.0.1:5000/ISteamApps/GetProductChanges/?since_changenumber=5755420
{"app_changes":[{"appid":800000,"change_number":5755444,"needs_token":true},{"appid":1015480,"change_number":5755443,"needs_token":true},{"appid":362620,"change_number":5755442},{"appid":301000,"change_number":5755441,"needs_token":true},{"appid":512470,"change_number
":5755440},{"appid":349110,"change_number":5755439},{"appid":809470,"change_number":5755438},{"appid":367970,"change_number":5755437},{"appid":743320,"change_number":5755436,"needs_token":true},{"appid":690640,"change_number":5755435,"needs_token":true},{"appid":80914
0,"change_number":5755434},{"appid":962290,"change_number":5755433,"needs_token":true},{"appid":966430,"change_number":5755432,"needs_token":true},{"appid":988430,"change_number":5755431},{"appid":648800,"change_number":5755430},{"appid":648350,"change_number":5755429
},{"appid":333950,"change_number":5755428},{"appid":1024860,"change_number":5755427,"needs_token":true},{"appid":941460,"change_number":5755426,"needs_token":true},{"appid":447700,"change_number":5755423,"needs_token":true},{"appid":1008040,"change_number":5755421}],"
current_change_number":5755444,"package_changes":[{"change_number":5755425,"packageid":341148},{"change_number":5755424,"packageid":341147}],"since_change_number":5755420}
(venv) C:\Users\Woctezuma\PycharmProjects\SimpleWebAPI>curl 127.0.0.1:5000/ISteamApps/GetPlayerCount/?appid=0
{"eresult":1,"player_count":14634045}
The recipe is from 2 years ago, and some things have changed. I've pushed an update for the code, it should work now.
Hello,
I am trying to run recipe n°2
SimpleWebAPI
.I have edited
run_webapi.py
as suggested in #97, by adding these two lines at the top of the file.I hve also edited the following import for Python 3:
After I run
python run_webapi.py
, input my username, password and 2FA code, the following is displayed:Then I try to run the following in a terminal, as suggested in the README:
However, I encounter the following error: