Skip to main content

A python library that parses TF2 item SKU to the item's name and vice versa.

Project description

tf2-sku

A Python library for parsing Team Fortress 2 item SKUs to item names and vice versa.

Features

  • Convert SKUs to item names
  • Convert item names to SKUs

Installation

pip install tf2-sku-to-name

Quick Start

from sku import Sku

# Convert SKU to name
sku = "5021;6"
name = Sku.sku_to_name(sku)
print(name)  # Output: Mann Co. Supply Crate Key

# Convert name to SKU
name = "Burning Flames Team Captain"
sku = Sku.name_to_sku(name)
print(sku)  # Output: 378;5;u13

# Working with item objects
from sku import itemClass

item = itemClass()
item.Defindex = 424
item.Quality = 11
item.Killstreak = 3

sku = Sku.object_to_sku(item)
print(sku)  # Output: 424;11;kt-3

Advanced Usage

Schema Management

The library automatically manages TF2 schema data:

from sku import get_schema, update_schema

# Get the current schema instance
schema = get_schema()

# Access schema data
item = schema.get_item_by_defindex(5021)
print(item['item_name'])  # Mann Co. Supply Crate Key

# Force update schema (by default uses autobot.tf)
update_schema()

# Or use Steam API (requires API key)
update_schema(api_key="YOUR_STEAM_API_KEY", use_autobot=False)

Installation

pip install tf2-sku-to-name

Acknowledgements

TF2Autobot's node-tf2-schema for the original JavaScript implementation
idinium96's tf2autobot for the item name schema
Inspired by Nicklason's node-tf2-sku and TryHardDo's TF2Sku

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tf2_sku_to_name-2.0.2.tar.gz (14.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tf2_sku_to_name-2.0.2-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file tf2_sku_to_name-2.0.2.tar.gz.

File metadata

  • Download URL: tf2_sku_to_name-2.0.2.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for tf2_sku_to_name-2.0.2.tar.gz
Algorithm Hash digest
SHA256 af8a8183a9a15d3ffb22ce172862499b5f4f8b3b456de8b1f997987a0f1d796d
MD5 b845ccb0fc4e620dc13c0eab646df1e3
BLAKE2b-256 3256a4889a9efe5b528f1b4efd038ee04f1c7640d70f774aea32c0ba058ac9c7

See more details on using hashes here.

File details

Details for the file tf2_sku_to_name-2.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for tf2_sku_to_name-2.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8a7db44d5561a86a8d206123e93463ccdb0a095ae6d83431783db8c9d1eaf136
MD5 a726937128cc346a70a37f87729ecf4b
BLAKE2b-256 4ac83088f165300fb3588f4e3dee6a689fb482d91a7c452925710145c4fc3dac

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page