Tools and utilities for TF2 trading. Use 3rd party inventory providers, get SKUs directly from inventories, listen to BackpackTF's websocket and more.
- BTC:
bc1qntlxs7v76j0zpgkwm62f6z0spsvyezhcmsp0z2
- Steam Trade Offer
- Uses tf2-sku
- Uses tf2-data
- Get SKUs directly from inventories/offers
- Convert name to SKU and vice versa
- Fetch inventories using 3rd party providers (avoid being rate-limited)
- Listen for Backpack.TF websocket events
- Listen for Prices.TF websocket events
- Interact with Prices.TF's API
- Get item properties (
is_craft_hat
,get_paint
,get_effect
etc.) - Fetch TF2 Schema data
- Convert SKU/defindex to item image URL
- Calculate scrap and refined prices
pip install tf2-utils
# or
python -m pip install tf2-utils
pip install --upgrade tf2-utils tf2-sku tf2-data
# or
python -m pip install --upgrade tf2-utils tf2-sku tf2-data
See examples or tests for more usage examples.
from tf2_utils import Inventory
# using 3rd party provider to avoid being rate-limited
provider = Inventory("steamsupply", "9st947vs0qmgfpeqde1gj92l0oqmhysm")
# using steam as inventory provider
provider = Inventory() # or Inventory("steamcommunity")
# get an inventory
inventory = provider.fetch("76561198253325712")
NOTE: NOT ALL SKU ATTRIBUTES ARE ADDED YET
from tf2_utils import Inventory, map_inventory
provider = Inventory("steamcommunity")
user_inventory = provider.fetch("76561198253325712")
inventory = map_inventory(user_inventory, add_skus=True)
from tf2_utils import get_sku
inventory = map_inventory(user_inventory)
for item in inventory:
sku = get_sku(item)
from tf2_utils import BackpackTFSocket
def my_function(data: dict):
print("got data!", data)
socket = BackpackTFSocket(my_function)
socket.listen()
from tf2_utils import BackpackTFSocket
def my_function(data: list[dict]):
print("got listings")
for listing in data:
print("listing", listing)
socket = BackpackTFSocket(my_function, solo_entries=False)
socket.listen()
from tf2_utils import PricesTFSocket
def my_function(data: dict):
print("got data!", data)
socket = PricesTFSocket(my_function)
socket.listen()
# tf2-utils/
python -m unittest