Skip to main content

Python Steam library

Project description

Asynchronous python library for work with Steam

pypi: package Imports: isort Linter: flake8 Mypy: checked Python: versions

Install

pip install pysteamlib

Usage

from typing import Dict

from pysteamauth.auth import Steam
from steamlib.api import SteamAPI
from steamlib.api.account import PrivacyInfo
from steamlib.api.account.schemas import ProfileInfo
from steamlib.api.store.purchase import TransactionStatusResponse
from steamlib.api.trade import Asset, JsonTradeoffer, Me, SendOfferRequest, SendOfferResponse, Them, TradeOfferParams


async def usage(steam: Steam) -> None:

    if not await steam.is_authorized():
        await steam.login_to_steam()

    api = SteamAPI(steam)

    # Store
    purchase_status: TransactionStatusResponse = await api.store.purchase_game(appid='808080')

    # Account
    current_tradelink: str = await api.account.get_tradelink()
    new_tradelink: str = await api.account.register_tradelink()
    privacy_settings: PrivacyInfo = await api.account.get_current_privacy()
    profile_info: ProfileInfo = await api.account.get_current_profile_info()
    api_key: str = await api.account.register_api_key('example.com')

    # Inventory
    inventory: Dict = await api.inventory.get_inventory(appid='730', contextid=2)

    # Trade
    response: SendOfferResponse = await api.trade.send_offer(
        request=SendOfferRequest(
            partner=76561111111111111,
            json_tradeoffer=JsonTradeoffer(
                me=Me(
                    assets=[Asset(appid='730', contextid='2', assetid='111111111111')]
                ),
                them=Them(
                    assets=[Asset(appid='730', contextid='2', assetid='111111111111')],
                ),
            ),
            sessionid=await steam.sessionid(),
            trade_offer_create_params=TradeOfferParams(
                trade_offer_access_token='token',
            ),
        ),
    )
    
    if response.needs_mobile_confirmation:
        confirmation_result: bool = await api.trade.mobile_confirm_by_tradeofferid(
            tradeofferid=response.tradeofferid,
        )

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

pysteamlib-0.0.2.tar.gz (13.3 kB view details)

Uploaded Source

Built Distribution

pysteamlib-0.0.2-py3-none-any.whl (19.6 kB view details)

Uploaded Python 3

File details

Details for the file pysteamlib-0.0.2.tar.gz.

File metadata

  • Download URL: pysteamlib-0.0.2.tar.gz
  • Upload date:
  • Size: 13.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.2

File hashes

Hashes for pysteamlib-0.0.2.tar.gz
Algorithm Hash digest
SHA256 96c7cb6bfb81a5a2d7d89fc9f9e1c4ee421cbd15fc9454bd2b22931206ac219e
MD5 e4160ab027a6ebca3b0a590f1f5debc1
BLAKE2b-256 91b870913ddfd8753463e24b243ab9be36eb49de04ef2c8a9022edd25c071050

See more details on using hashes here.

Provenance

File details

Details for the file pysteamlib-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: pysteamlib-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 19.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.2

File hashes

Hashes for pysteamlib-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 58686775aef4d547f01c784fd0e9cc7559160a8a18899e4cc210dd2a17cc3211
MD5 32947d481c67358fa58404a7f3d1ef4f
BLAKE2b-256 e19d23d863aa13792f244aac5dbfdcffcb21983d113712d4f32b72f1ab7eba1d

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page