Skip to main content

CSFloat Async API Client (Unofficial)

An unofficial, asynchronous Python library for interacting with the CSFloat API. This library provides full support for programmatic access to listings, buy orders, user data, exchange rates, and more. All prices returned by the server are in cents.

Key Features

  • Asynchronous design: Built on aiohttp for non-blocking I/O.
  • Fetch listings: Retrieve detailed listings with filters (price in cents, float, rarity, etc.).
  • Buy orders: Get and manage buy orders for specific items.
  • User information: Access your own profile, trades, and stall data.
  • Listing management: Create, delete, and modify listings and buy orders.
  • Proxy support: Optional SOCKS4/5 and HTTP(S) proxy support.
  • Error handling: Clear exceptions with descriptive messages.

Installation

Install via pip:

pip install csfloat_api

Quick Start

import asyncio
from csfloat_api.csfloat_client import Client

async def main():
    async with Client(api_key="YOUR_API_KEY") as client:
        # Fetch up to 50 listings priced between $1.00 and $10.00 (i.e., 100–1000 cents)
        listings = await client.get_all_listings(min_price=100, max_price=1000)
        for listing in listings["listings"]:
            print(f"ID: {listing.id}, Price: {listing.price} cents, Float: {listing.item.float_value}")

        # Create a buy order for an item
        buy_order = await client.create_buy_order(
            market_hash_name="AK-47 | Redline (Field-Tested)",
            max_price=5000,  # 5000 cents = $50.00
            quantity=1
        )
        print(buy_order)

asyncio.run(main())

Session Management

The Client class manages an underlying HTTP session using aiohttp.ClientSession. To ensure that resources are properly released, it is important to close the session when you are done using the client.

Using async with

The recommended way to use the Client is with an async with statement, which automatically closes the session when the block is exited:

async with Client(api_key="YOUR_API_KEY") as client:
    # Use the client...

Manual Session Closing

If you cannot use async with, you can manually close the session using the close method:

client = Client(api_key="YOUR_API_KEY")
try:
    # Use the client...
finally:
    await client.close()

Failing to close the session may result in warnings about unclosed client sessions and potential resource leaks.

Core Methods

  • get_exchange_rates() – Retrieve current exchange rates.
  • get_all_listings(...) – List items with optional filters (prices in cents).
  • get_specific_listing(listing_id) – Get detailed info for a specific listing.
  • get_buy_orders(listing_id) – Retrieve buy orders for a listing.
  • get_my_buy_orders(...) – List your own buy orders.
  • get_me() – Fetch authenticated user profile.
  • get_stall(user_id) – Get a user's stall (listed items).
  • create_listing(asset_id, price, ...) – Create a new listing (price in cents).
  • create_buy_order(market_hash_name, max_price, quantity) – Place a buy order.
  • make_offer(listing_id, price) – Make an offer on a listing.
  • buy_now(total_price, listing_id) – Instantly buy one or more listings.
  • delete_buy_order(id) – Cancel an existing buy order.

For a full list of methods and parameters, refer to the library's source code.

Proxy Support

Optionally provide a proxy URL in the constructor:

client = Client(
    api_key="YOUR_API_KEY",
    proxy="socks5://user:pass@host:port"
)

Error Handling

The client raises exceptions for HTTP errors with clear messages:

  • 401 Unauthorized – Invalid API key.
  • 404 Not Found – Resource missing.
  • 429 Too Many Requests – Rate limit exceeded.
  • 500 Internal Server Error – Server-side issue.

Contributing

Contributions are welcome! Please submit issues and pull requests on the GitHub repository.

License

This project is licensed under the MIT License.

Metadata

Release files for csfloat-api 1.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for csfloat-api 1.3.0
File Size Uploaded
csfloat_api-1.3.0.tar.gz 13.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for csfloat-api 1.3.0
File Interpreter ABI Platform
csfloat_api-1.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 27.9 kB

Release files / csfloat_api-1.3.0.tar.gz

Download URL csfloat_api-1.3.0.tar.gz
Size 13.3 kB
Tags Source
SHA-256 checksum
How to use checksums
4b52d304d2067558bf4867ad4f52a2dd04beb6b5c1b26a3b57f0e8e302114612
BLAKE2b-256 checksum
How to use checksums
f66f71f2b70daf630c5f6eb9fc1c3d1176cd95be50c45c8f946b7a5a25d73605
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.6

Release files / csfloat_api-1.3.0-py3-none-any.whl

Download URL csfloat_api-1.3.0-py3-none-any.whl
Size 14.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1298193bd35e1d7c29df42d5b8b4c9e2c76a6c966a9f8238361668cb3cd2e6c3
BLAKE2b-256 checksum
How to use checksums
87b250fec0c8e2b66be4506cd96e788ec4ab252492c2e15116310e7fe6f90dd0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.6

Release history Release notifications | RSS feed

This release

1.3.0 This release

2 release files

1.1.0

2 release files

1.0.2

2 release files

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page