Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/offish/tf2-sku
Format items as strings or objects using Python 3.
https://github.com/offish/tf2-sku
backpacktf marketplacetf pricestf sku steam steamcommunity team-fortress-2 tf2 tf2-items tf2-trading-bot
Last synced: 3 months ago
JSON representation
Format items as strings or objects using Python 3.
- Host: GitHub
- URL: https://github.com/offish/tf2-sku
- Owner: offish
- License: mit
- Created: 2020-06-06T20:21:37.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-09-27T10:25:07.000Z (over 1 year ago)
- Last Synced: 2024-09-12T23:47:56.655Z (4 months ago)
- Topics: backpacktf, marketplacetf, pricestf, sku, steam, steamcommunity, team-fortress-2, tf2, tf2-items, tf2-trading-bot
- Language: Python
- Homepage:
- Size: 29.3 KB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tf2-sku
[![License](https://img.shields.io/github/license/offish/tf2-sku.svg)](https://github.com/offish/tf2-sku/blob/master/LICENSE)
[![Stars](https://img.shields.io/github/stars/offish/tf2-sku.svg)](https://github.com/offish/tf2-sku/stargazers)
[![Issues](https://img.shields.io/github/issues/offish/tf2-sku.svg)](https://github.com/offish/tf2-sku/issues)
[![Size](https://img.shields.io/github/repo-size/offish/tf2-sku.svg)](https://github.com/offish/tf2-sku)
[![Discord](https://img.shields.io/discord/467040686982692865?color=7289da&label=Discord&logo=discord)](https://discord.gg/t8nHSvA)
[![Code style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)Parse TF2 items to SKU format with Python.
tf2-sku is a dependency in [tf2-utils](https://github.com/offish/tf2-utils), which can get item SKUs directly from inventory/offers.
## Donate
- BTC: `bc1qntlxs7v76j0zpgkwm62f6z0spsvyezhcmsp0z2`
- [Steam Trade Offer](https://steamcommunity.com/tradeoffer/new/?partner=293059984&token=0-l_idZR)## Usage
```python
>>> from tf2_sku import to_sku, from_sku>>> to_sku({"defindex": 5021, "quality": 6})
"5021;6"
# https://marketplace.tf/items/tf2/5021;6>>> from_sku("161;3;kt-3")
{
"defindex": 161,
"quality": 3,
"effect": -1,
"australium": False,
"craftable": True,
"wear": -1,
"skin": -1,
"strange": False,
"killstreak_tier": 3,
"target_defindex": -1,
"festivized": False,
"craft_number": -1,
"crate_number": -1,
"output_defindex": -1,
"output_quality": -1,
}
# https://marketplace.tf/items/tf2/161;3;kt-3>>> to_sku({
... "defindex": 199,
... "quality": 5,
... "effect": 702,
... "wear": 3,
... "skin": 292,
... "strange": True,
... "killstreak_tier": 3
... })
"199;5;u702;w3;pk292;strange;kt-3"
# https://marketplace.tf/items/tf2/199;5;u702;w3;pk292;strange;kt-3
```## Setup
### Install
```bash
pip install tf2-sku
# or
python -m pip install tf2-sku
```### Upgrade
```bash
pip upgrade tf2-sku
# or
python -m pip upgrade tf2-sku
```## Testing
```bash
# tf2-sku/
python -m unittest
```