Skip to content

Client

Init & login

To prevent additional requests to steam when logging in we can pass all known data to init method.

from aiosteampy import SteamClient, Currency


client = SteamClient(
    "username",
    "password",
    112233,  # steam id(64) or account id(32)
    shared_secret="shared secret",
    identity_secret="identity secret",
    api_key="api key",
    trade_token="trade token",
    wallet_currency=Currency.UAH,
    wallet_country="UA",
)

await client.login()
Api key registration

If steam account does obtain api key, it will be automatically registered on https://github.com/somespecialone/aiosteampy during data initialization.

client.login args and data fetching

You can bypass this if pass init_data=False. But keep in mind - methods which requires missed data will throw errors.

Addition to args above, there is:

  • lang - language of requests data. Do not recommend to change this until you know what you're doing.
  • tz_offset - just time zone offset that will be set to cookie.
  • session - aiohttp.ClientSession.

Session

If you create session by yourself - raise_for_status must be True, ClientSession(..., raise_for_status=True). If not, errors will be not handled right and this will cause strange behavior.

Public methods client

Have methods that doesn't require authentication. Docs here

from aiosteampy import SteamPublicClient

client = SteamPublicClient()

histogram = await client.fetch_item_orders_histogram(12345687)
...

Proxies

For proxies support you can use aiohttp-socks as you can create session by yourself.

Inheritance

In case you need to use multiple inheritance and __slots__, you can subclass SteamCommunityMixin:

from aiosteampy.client import SteamCommunityMixin, SteamClient


class MyClient(SteamCommunityMixin, ...):
    __slots__ = (
        *SteamClient.__slots__,
        "attr",
        "attr1",  # your slots
    )

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        ...