Search code examples
pythonapisteamsteam-web-api

Can't get a steam user's inventory through the API


I'm trying to get info about a Steam user's inventory but it seems that I'm doing something wrong. After running script below (ofc first I replace PROFILEID with my Steam User ID) all I get is {'success': False}. Can anyone tell me how to fix this? I set my inventory as visible for everyone.

import requests

inventory = requests.get("http://steamcommunity.com/profiles/PROFILEID/inventory/json/730/1").json()
print(inventory)

After deleting ".json()" it prints <Response [200]>


Solution

  • Changing the 1 at the end of the URL to a 2 worked for me.

    https://steamcommunity.com/profiles/76561198048165534/inventory/json/730/1{"success":false}

    https://steamcommunity.com/profiles/76561198048165534/inventory/json/730/2{"success":true,"rgInventory":{"23071433672":{"id":"23071433672","classid":"1989287349","instanceid":"302028390", ...