Skip to main content

Python Steam library

Project description

Asynchronous python library for work with Steam

pypi: package Python: versions

Install

pip install pysteamlib

Usage

Getting started

from pysteamauth.auth import Steam
from steamlib.api import SteamAPI

steam = Steam(
    login='login',
    password='password',
    shared_secret='shared_secret',
    identity_secret='identity_secret',
    device_id='device_id',
)
await steam.login_to_steam()
api = SteamAPI(steam)

Account API

from steamlib.api import SteamAPI
from steamlib.api.account import PrivacyInfo
from steamlib.api.account.schemas import ProfileInfo

async def usage(api: SteamAPI):

    # Get current tradelink
    current_tradelink: str = await api.account.get_tradelink()
    
    # Register new tradelink
    new_tradelink: str = await api.account.register_tradelink()
    
    # Privacy settings
    privacy_settings: PrivacyInfo = await api.account.get_current_privacy()
    
    # Get profile info
    profile_info: ProfileInfo = await api.account.get_current_profile_info()
    
    # Register api key
    api_key: str = await api.account.register_api_key('example.com')

Trade API

from steamlib.api import SteamAPI
from steamlib.api.trade import Asset, JsonTradeoffer, SendOfferRequest


async def usage(api: SteamAPI):

    response = await api.trade.send_offer(
        request=SendOfferRequest(
            partner=steamid,
            tradelink='tradelink',
            me=[
                Asset(
                    appid='appid',
                    contextid='contextid',
                    amount=1,
                    assetid='assetid',
                ),
            ],
            them=[],
        ),
    )
    if error := response.get('strError'):
        print('Send offer error:', error)
        return
    tradeofferid = response['tradeofferid']
    await api.trade.mobile_confirm_by_creator_id(tradeofferid)
    await api.trade.cancel_offer(tradeofferid)

License

MIT

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-1.0.1.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

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

pysteamlib-1.0.1-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pysteamlib-1.0.1.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for pysteamlib-1.0.1.tar.gz
Algorithm Hash digest
SHA256 88bb58047118afb0a9fd7f428228769a106e4d19625b1ca4379a7bd4ebb18ce0
MD5 a73ff121bb7884e431264041f976d733
BLAKE2b-256 9da89114745078fdbc7505f08eee5fc48415c3a6cedfcb90635fdd17c6c67b1f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pysteamlib-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 18.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for pysteamlib-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a8f26f7313ad6de44f76cd612f861031faedb480e7b6038a7268875e4844011b
MD5 1da399a45b65ea85c34a69e9844f1ace
BLAKE2b-256 e8299302910ef30c17b2d50b93752037e7eb57426f3ec7e9f03577556455ae9f

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