Tools and utilities for TF2 trading
Project description
tf2-utils
Tools and utilities for TF2 trading. Use 3rd party inventory providers, get SKUs directly from inventories, listen to BackpackTF's websocket and more.
Donate
- BTC:
bc1qntlxs7v76j0zpgkwm62f6z0spsvyezhcmsp0z2
- Steam Trade Offer
Usage
Inventory fetching
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")
Gettings SKUs from inventories
NOTE: NOT ALL SKU ATTRIBUTES ARE ADDED YET
Get SKUs implicitly
from tf2_utils import Inventory, map_inventory
provider = Inventory("steamcommunity")
user_inventory = provider.fetch("76561198253325712")
inventory = map_inventory(user_inventory, add_skus=True)
Get a particular item's SKU
from tf2_utils import get_sku
inventory = map_inventory(user_inventory)
for item in inventory:
sku = get_sku(item)
BackpackTF Websocket
Handle one listing at a time
from tf2_utils import BackpackTFWebsocket
def my_function(data: dict):
print("got data!", data)
socket = BackpackTFWebsocket(my_function)
socket.listen()
Handle list of listings at a time
from tf2_utils import BackpackTFWebsocket
def my_function(data: list[dict]):
print("got listings")
for listing in data:
print("listing", listing)
socket = BackpackTFWebsocket(my_function, solo_entries=False)
socket.listen()
Setup
Install
pip install tf2-utils
# or
python -m pip install tf2-utils
Upgrade
pip upgrade tf2-utils
# or
python -m pip upgrade tf2-utils
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
tf2-utils-2.0.0.tar.gz
(62.2 kB
view hashes)
Built Distribution
tf2_utils-2.0.0-py3-none-any.whl
(63.9 kB
view hashes)
Close
Hashes for tf2_utils-2.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dae1f34cb8073033932dc5646691af14a43e5f0d3e99046fb8d1c38f36555129 |
|
MD5 | 86767f6181cf4be3f4f3645c0092f1e4 |
|
BLAKE2b-256 | 2f613198cb3c7895f15cda0e6e47b77547d1b078e754da0297e454ccb8e06c06 |