Python Steam library
Project description
Asynchronous python library for work with Steam
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
Release history Release notifications | RSS feed
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.1.tar.gz
(13.3 kB
view hashes)
Built Distribution
pysteamlib-0.0.1-py3-none-any.whl
(19.6 kB
view hashes)
Close
Hashes for pysteamlib-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 086b6e520fc8315a5d712a308730dc6e3416e45752503295fa9b62348ed7171d |
|
MD5 | cebe1cb700001a3e23bae0286fc7b90e |
|
BLAKE2b-256 | 476f5e44cc918f19cdb876624eea104a13cdb81fc700f22845012e1b445b7ba2 |