Question

Bit of a random question :). I'm running a few Steam Team Fortress 2 (TF2) idle accounts to acquire items for the production of metal.

I've set up a few bash scripts to connect each account a couple of hours a day through the night. What I've found over the last couple of years that various things will cause the automatic account logins to fail. Which I wouldn't normally notice until I decide to look at the server, which I do rarely.

So I thought one way to ensure thing were working correctly would be to write a script that would log into each account (say daily) and list/count the number items it has. Log it have something like Splunk pick it up (which I already have running for other stuff).

So after that long winded explanation, my question is, does anyone know how to write a script that can retrieve the item information from a TF2 account. My current bash scripts can perform the log in to Steam and can start up TF2, but I have no idea if that is the correct/best way to retrieve item info or even if I can be done from the same bash script used to log in.

Happy to use any language, but do have a fondness for Python.

Thanks.

Was it helpful?

Solution

Valve has released a web api which provides a flexible way to query your items from outside the game. First, grab an api key by following the instructions at http://steamcommunity.com/dev.

Next, in your script, fetch http://api.steampowered.com/IEconItems_440/GetPlayerItems/v0001/?key=API_KEY&steamid=STEAMID where API_KEY and STEAMID are your api key and 64-bit steam id respectively. This returns a JSON file which contains a list of all the items in your inventory. Just grab the size of the items array.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top