I am trying to do a simple GET request to the Steam API:
If I do in the terminal:
curl http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/\?key\=XXXXXX\&steamids\=76561197960435530
It works:
{"response":{"players":[{"steamid":"76561197960435530","communityvisibilitystate":3,"profilestate":1,"personaname":"Robin","profileurl":"https://steamcommunity.com/id/robinwalker/","avatar":"https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/f1/f1dd60a188883caf82d0cbfccfe6aba0af1732d4.jpg","avatarmedium":"https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/f1/f1dd60a188883caf82d0cbfccfe6aba0af1732d4_medium.jpg","avatarfull":"https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/f1/f1dd60a188883caf82d0cbfccfe6aba0af1732d4_full.jpg","avatarhash":"f1dd60a188883caf82d0cbfccfe6aba0af1732d4","personastate":0,"realname":"Robin Walker","primaryclanid":"103582791429521412","timecreated":1063407589,"personastateflags":0,"loccountrycode":"US","locstatecode":"WA","loccityid":3961}]}}
However, when I type in my local browser the url, I get 404 Bad Request: "Required parameter 'key' is missing".
I though it might be related with CORS, so I tried to sent the response from a local flask application:
import requests
from flask import Flask
app = Flask(__name__)
@app.route('/')
@cross_origin()
def get_data():
return(requests.get('http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/\?key\=XXXXXXX\&steamids\=76561197960435530').content)
But I also get 404 Not Found error
When you're making the request via Flask or typing it in your browser, do not escape the url yourself (if you look at the url, you will see stuff like \?
and \=
Use the full url ie
http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=XXXXXXX&steamids=76561197960435530
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.