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,CurrencyandPhase - 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),
currency=Currency.USD,
)
print(res.market_hash_name, res.listings[0].market, res.listings[0].ask_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)
Item Contents
async with CSMarketAPI("YOUR_API_KEY") as client:
res = await client.get_item_contents(market_hash_name="Kilowatt Case")
print(res.contents)
Account
async with CSMarketAPI("YOUR_API_KEY") as client:
account = await client.get_account()
print(account.plan, account.usage.remaining)
Error Handling & Tipps
- Wrap API calls in
try/exceptfor network errors - Optional fields may be
None - Use
markets=list(Market)for all markets
License
MIT
Metadata
Release files for csmarketapi 3.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| csmarketapi-3.0.0.tar.gz | 6.7 kB | Without provenance | Details for csmarketapi-3.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| csmarketapi-3.0.0-py3-none-any.whl | Python 3 | none | any | Details for csmarketapi-3.0.0-py3-none-any.whl |
Total release size: 12.7 kB
Release files / csmarketapi-3.0.0.tar.gz
| Download URL | csmarketapi-3.0.0.tar.gz |
|---|---|
| Size | 6.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ce55be062d8695f5b8d391e1fb97340cb9ac7e033f13309f71dfc25f5f34ff3d
|
|
BLAKE2b-256 checksum How to use checksums |
f06425a1a05cc240184390059133a40276d630f0915fbbf7c71804d026e4e1b3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","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}
|
Release files / csmarketapi-3.0.0-py3-none-any.whl
| Download URL | csmarketapi-3.0.0-py3-none-any.whl |
|---|---|
| Size | 6.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cf3b7fcd46d37468c6cf94a740e8de9efd4170a6be68161bf69d051c913d3f2b
|
|
BLAKE2b-256 checksum How to use checksums |
acc55b3be33b2244f5773a84d60b3465896cfc900f0f753721047f7a9a524e10
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","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}
|
Security for csmarketapi 3.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.