Skip to main content

The official python library for CSMarketAPI

Project description

CSMarketAPI Client

Asynchronous Python client for CSMarketAPI — typed responses (Pydantic), enums for marketplaces/currencies, and convenient async context managers.

Highlights

  • Async & Fast: Use with async with CSMarketAPI(...)
  • Typed Models: All responses are Pydantic models
  • Enums: For Market and Currency
  • Modern Python: 3.13+, type hints everywhere

Installation

pip install csmarketapi

Requirements

  • Python 3.13+
  • CSMarketAPI API key

Quickstart

import asyncio
from csmarketapi import CSMarketAPI
from csmarketapi.enums import Market, Currency

async def main():
    async with CSMarketAPI("YOUR_API_KEY") as client:
        items = await client.get_items()
        print(f"Loaded {len(items.items)} items.")

asyncio.run(main())

Usage Examples

All methods are async and return Pydantic models.

Listings (Latest)

async with CSMarketAPI("YOUR_API_KEY") as client:
    res = await client.get_listings_latest_aggregated(
        market_hash_name="Chroma 2 Case",
        markets=list(Market)
        curreny=Currency.USD
    )
    print(res.market_hash_name, res.listings[0].market, res.listings[0].min_price)

Sales (Latest)

async with CSMarketAPI("YOUR_API_KEY") as client:
    res = await client.get_sales_latest_aggregated(
        market_hash_name="Chroma 2 Case",
        markets=[Market.SKINPORT, Market.SKINBARON]
    )
    print(res.sales[0].market, res.sales[0].median_price)

Currency Rates

async with CSMarketAPI("YOUR_API_KEY") as client:
    rates = await client.get_currency_rates()
    print(rates.items)

Steam Inventory

async with CSMarketAPI("YOUR_API_KEY") as client:
    inv = await client.get_steam_inventory(steam_id="YOUR_STEAM_ID")
    print(inv.assets)

Error Handling & Tipps

  • Wrap API calls in try/except for network errors
  • Optional fields may be None
  • Use markets=list(Market) for all markets

License

MIT


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

csmarketapi-2.0.0.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

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

csmarketapi-2.0.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file csmarketapi-2.0.0.tar.gz.

File metadata

  • Download URL: csmarketapi-2.0.0.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for csmarketapi-2.0.0.tar.gz
Algorithm Hash digest
SHA256 7d7b0989eee54a9ab5d89b268fce1c1eec7a6e9e7fb6c569bda791e5733d35cb
MD5 ce21cb4e28775b3a64fe9feca9d3b62b
BLAKE2b-256 015cccaf9c9012adee111ab18b2e53777111b115b3736e36c8d17571f13f5462

See more details on using hashes here.

File details

Details for the file csmarketapi-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: csmarketapi-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for csmarketapi-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a7e5e3383b33a2ffad03ffe50248613b1622b7242467dd422d038b36d68e88cd
MD5 e3fbae7a865dacc5d281415cbf2cabd2
BLAKE2b-256 8ba0b3c2771cae8dad6f210239aebed8cdf919e42fea39f2af48f2fcd33797be

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