/clever-inspect

๐Ÿ”ซ CSGO items inspect service

Primary LanguagePythonMIT LicenseMIT

Clever inspect


license Tests Docker Cloud Automated build Docker Image Size (latest by date) Docker Image Version (latest by date) CodeFactor codecov black steam

Service for inspecting CSGO items - retrieving detail information (such as wear e.g. float value, customname, paintseed, paintindex etc.) from steam game servers and enrich it with additional info from game schemas (phases, cases, other possible stuff) from csgo-items-db.

This project was inspired most by csgofloat-inspect ๐Ÿ’–


Navigation


Usage

All info about params, responses and requests available in openapi.json schema on /docs or /redoc path โ— (thanks to fastapiโšก and others)

Request params:

Param Definition
s: int steamid64 of user who owns item
m: int market id of item
a: int asset id of item
d: int special d param from inspect link

Params s and m are mutually exclusive โš .

OR

Param Definition
url: str inspect url (e.g. steam://rungame/730/.../+csgo_econ_action_preview%20M...A...D...)

Optional

Param Definition
raw: bool return raw (with decoded wear), without additional info inspected item if true

Response

{
  "id": 1234567890,  // asset id
  "defindex": 33, 
  "rarity": 2,
  "quality": 12,
  "origin": 8,
  "paintindex": 15,  // optional
  "paintseed": 447,  // optional
  "paintwear": 0.335,  // optional
  "customname": "",  // optional
  "killeaterscoretype": null,  // optional
  "killeatervalue": null,  // optional
  "stickers": [  // optional
    {
      "slot": 0,
      "id": 5025,
      "wear": 0,  // optional
      "scale": 1,  // optional
      "rotation": 0,  // optional
      "tint_id": null,  // optional
      "sticker_kit": {
        "image": "https://steamcdn-a.akamaihd.net/apps/730/icons/econ/stickers/stockh2021/tyl_gold.92a91b7f13bb0022dd566ef608e5f118da644a8a.png",
        "name": "Tyloo (Gold) | Stockholm 2021"
      }
    }
  ],
  "item": {
    "image": "http://media.steampowered.com/apps/730/icons/econ/default_generated/weapon_mp7_hy_gelpen_light_large.e19dd688c21ae094ffc3649e80ee1c1f0959125a.png",
    "paint": {  // optional
      "name": "Gunsmoke",
      "wear_max": 0.8,
      "wear_min": 0.06
    },
    "rarity": {
      "color": "#5e98d9",
      "name": "Industrial Grade"  // optional (some agents doesn't have rarity name)
    },
    "type": {
      "category": "smg",
      "name": "MP7"
    },
    "cases": [  // optional
      {
        "image": "https://steamcdn-a.akamaihd.net/apps/730/icons/econ/weapon_cases/crate_community_28.1f6e656d8fc297c9f2b65f2c05b8552d1cc63082.png",
        "name": "Snakebite Case",
        "set": "The Snakebite Collection"
      }
    ]
  },
  "quality_name": "Souvenir",
  "wear_name": "Field-Tested",  // optional
  "origin_name": "Found in Crate"
}

Health โž•

You can check health of app on /health path.

Response:

{
  "online": 2,  // count of bots working
  "total": 2,  // total count of bots
  "concurrency": 1,  //  ready to inspect item bots in queue
}

Integrity schema ๐Ÿงพ

From csgo-items-db

integrity schema

Deployment ๐Ÿš€

To obtain secrets of steam account you can use SDA. Your bots don't need to have CSGO license, service will automatically request free license for you ๐Ÿ’Œ

Docker ๐Ÿณ

Just copy content of docker-public dir to work directory on your host machine and place filled cred.json file near.

Command to run:

docker-compose up

Docker spawns named volume inspect-service-data where inspect-service store cached items database. Feel free to modify docker-compose.yml to provide your configuration.

List of possible env variables you can see in config.py AppSettings class.

Service will be available on 80 default port (localhost if you run it on local machine)

Manual ๐Ÿ› 

Clone this repository, install dependencies with

poetry install --no-dev

Place filled cred.json file in project root (choose preferable port), create data dir in project root and run with uvicorn:

uvicorn app.main:app --host 0.0.0.0 --port 8000

Testing ๐Ÿงช

Simple clone repo, install dependencies and run pytest from project root.

poetry install

poetry run pytest

# or
pytest

TODO ๐Ÿ“‘

  • Explicit error responses.
  • Omit UserWarning about api key from steamio.
  • Requesting free license for CSGO when started.
  • Errors catching/logging when requesting free license.