Skip to main content

All In One Sellers API - Universal API for various digital trading platforms (such as PlayerOK or FunPay). Provides developers with a convenient way to create bots on any platform.

Project description

All-In-One Sellers API

Python License: Apache 2.0

Asynchronous Python wrapper for working with digital trading platforms. Currently implemented module for PlayerOK.

Python


Installation

pip install aiosellers

or via uv:

uv add aiosellers

Requirements: Python 3.12+


Configuration

Token can be passed to the constructor or via environment variable:

export PLAYEROK_ACCESS_TOKEN="your_token_here"

Quick Start

import asyncio
from aiosellers.playerok import Playerok

async def main():
    async with Playerok() as client:
        me = await client.account.me()
        profile = await client.account.profile()

        print(f"User: {me.username} ({me.email})")
        print(f"Rating: {profile.rating} | Reviews: {profile.reviews_count}")
        print(f"Balance: {profile.balance.available} (pending: {profile.balance.pending_income})")
        print(f"Unread chats: {me.unread_chats_counter}")

asyncio.run(main())

Examples

1. Account Information

async with Playerok() as client:
    me = await client.account.me()
    profile = await client.account.profile()

    print(f"{me.username} | {me.email}")
    print(f"Rating: {profile.rating} ({profile.reviews_count} reviews)")
    print(f"Available: {profile.balance.available}")
    print(f"Pending: {profile.balance.pending_income}")

2. Market Analysis: Average Item Price

from statistics import mean

async with Playerok() as client:
    games = await client.games.list(search="dota", limit=1)
    game = games[0]

    items = await client.items.list(game_id=game.id, search="mmr", limit=100)
    prices = [i.price for i in items if i.price]

    print(f"{game.name}: avg price = {mean(prices):.2f}")

3. Working with Chats

async with Playerok() as client:
    user = await client.account.get_user(username="some_user")
    chat = await user.get_chat()

    if not chat:
        print("No chat found")
        return

    messages = await chat.get_messages(limit=20)
    for msg in messages:
        print(f"{msg.sent_at} | {msg.user.username if msg.user else 'system'}: {msg.text}")
        await msg.mark_as_read()

    await chat.send_text("Hello!")

4. Automatic Item Position Upgrade

async with Playerok() as client:
    items = await client.items.list_self(limit=50)

    for item in items:
        pos = item.priority_position or 999
        if pos < 15:
            await item.set_premium_priority()
            print(f"Upgraded: {item.name}")

5. Batch Deal Processing

from aiosellers.playerok.schemas import ItemDealStatuses

async with Playerok() as client:
    user = await client.account.get_user(user_id="...")

    # Send all paid orders
    paid = await client.deals.list(statuses=[ItemDealStatuses.PAID], user_id=user.id)
    for deal in paid:
        await deal.complete()
        print(f"Sent: {deal.id}")

    # Confirm all sent orders
    sent = await client.deals.list(statuses=[ItemDealStatuses.SENT], user_id=user.id)
    for deal in sent:
        await deal.confirm()
        print(f"Confirmed: {deal.id}")

6. Creating an Item with Image

async with Playerok() as client:
    category = await client.games.get_category(slug="skins", game_id="...")
    obtaining_types = await category.get_obtaining_types()
    obtaining_type = obtaining_types[0]

    # Get options (server, region, etc.)
    options = await category.get_options()
    for opt in options:
        opt.set_value(opt.possible_values[0].value)  # select first value

    # Get data fields (fields for seller)
    data_fields = await obtaining_type.get_data_fields()
    for field in data_fields:
        if field.required:
            field.set_value("item data")

    item = await client.items.create(
        category=category.id,
        obtaining_type=obtaining_type.id,
        name="Rare Skin",
        price=1500,
        description="Instant delivery",
        options=options,
        data_fields=data_fields,
        attachments=["https://example.com/preview.jpg"]
    )

    await item.publish(premium=False)
    print(f"Created: {item.id}")

7. Sniper: Buying the Cheapest Item

import asyncio

async with Playerok() as client:
    games = await client.games.list(search="dota", limit=1)
    items = await client.items.list(game_id=games[0].id, search="arcana", limit=50)

    cheapest = min([i for i in items if i.price], key=lambda x: x.price)

    # Fill in item obtaining fields
    fields = await cheapest.get_obtaining_fields()
    for f in fields:
        if f.required:
            f.set_value("your_data_here")

    deal = await cheapest.create_deal(obtaining_fields=fields)
    await asyncio.sleep(1) # Wait for chat creation on server
    chat = await deal.get_chat()
    await chat.send_text("Hello!")

    print(f"Bought {cheapest.name} for {cheapest.price}")

Development Status: PlayerOK

Module Raw API High-level
Account
Games / Categories
Items
Deals
Chats
Transactions 🚧
Event Feed 🚧 🚧

Acknowledgments

Based on ideas from PlayerokAPI


Built by developers for developers.

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

aiosellers-0.1.2.tar.gz (43.7 kB view details)

Uploaded Source

Built Distribution

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

aiosellers-0.1.2-py3-none-any.whl (58.2 kB view details)

Uploaded Python 3

File details

Details for the file aiosellers-0.1.2.tar.gz.

File metadata

  • Download URL: aiosellers-0.1.2.tar.gz
  • Upload date:
  • Size: 43.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.1

File hashes

Hashes for aiosellers-0.1.2.tar.gz
Algorithm Hash digest
SHA256 f30eae54c044c24d5fa87396865b60b2d6673ddfd7cb8315693daa33e97808aa
MD5 662a4739cfc7d8077e994e21f66603cd
BLAKE2b-256 f66bef35c7a011473a3f28411ca6ecf11f8a9e0f3268e2b56ccbac654e56b960

See more details on using hashes here.

File details

Details for the file aiosellers-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: aiosellers-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 58.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.1

File hashes

Hashes for aiosellers-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fc83f4bdbac5f4f996fb7def757bf03e04b8494d30a48d64a285fa9a8e5a879b
MD5 077da76bf6c8d8ee82256dc1c112554a
BLAKE2b-256 2dfa28a9ac73a1e6cac6741c35eb4bb626d5fac0e26dcc3b7d0669b9ee9563da

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