Skip to main content

Table of Content

Also you can see see some basic examples in folder examples

Credits

  • bukson for the steampy library, in fact, I took more than 50% of the code from him
  • rossengeorgiev for the steam library, in it I looked at how to implement a mobile web session
  • melvyn2 for the PySteamAuth program, his code helped me implement multiple confirmations
  • DoctorMcKay for his libraries, which I also turned to during development

Installation

This program not associated with Valve Corp

pip install steamcom

SteamClient Methods

login() -> None

from steamcom.client import SteamClient


username = 'GabeNewell'
password = '124567'
shared_secret = 'zu+yLsdfjJRbg2FP+vsW+oNE='
identity_secret = 'U+Rs50612sdflkHlZ86ffPzgs='

steam_client = SteamClient(username, password, shared_secret, identity_secret)
steam_client.login()
print(steam_client.was_login_executed) # True
print(steam_client) # SteamClient: GabeNewell

Can send blank '' in shared_secret you will be asked to enter the 2fa code manually

extract_session() -> dict

Needed to save the session, you can save it from json or txt and use it in the future

extracted_session = steam_client.extract_session()
print(extracted_session) # {"steamid": "76...82", "currencyid": 1, "refresh_token": "uy...BD", "cookies": list[dict[str, int]]}

load_session(extracted_session: Mapping[str, str]) -> None

from steamcom.client import SteamClient


steam_client = SteamClient(username, passowrd, shared_secret, identity_secret)
# extracted_session format
# {"steamid": "76...82", "currencyid": 1, "refresh_token": "uy...BD", "cookies": list[dict[str, int]]}
steam_client.load_session(extracted_session)

is_session_alive() -> bool

get_partner_inventory(partner_steam_id: str, app_id: str, context_id: str, delay: int = 3) -> dict:

Return parsed inventory:

{'assets': {
    '12176056772': {
        'actions': ...,
        'amount': '1',
        'appid': 440,
        'background_color': '3C352E',
        'classid': '2569645959',
        'commodity': 0,
        'contextid': '2',
        'currency': 0,
        'descriptions': ...,
        'icon_url': ...,
        'icon_url_large': ...,
        'id': '12176056772',
        'instanceid': '5020381097',
        'market_actions': ...,
        'market_hash_name': 'Civic Duty Mk.II War Paint '
                            '(Field-Tested)',
        'market_marketable_restriction': 0,
        'market_name': 'Civic Duty Mk.II War Paint '
                       '(Field-Tested)',
        'market_tradable_restriction': 7,
        'marketable': 1,
        'name': 'Civic Duty Mk.II War Paint',
        'name_color': 'FAFAFA',
        'tags': ...
        'tradable': 0,
        'type': ''}},
 'total_inventory_count': 1}

get_wallet_info(self) -> WalletInfo:

WalletInfo(currency=5, country='RU', state='', fee='1', fee_minimum=77, fee_percent=0.05, publisher_fee_percent_default=0.1, market_minimum=77, currency_increment=1, fee_base=0, balance=2297.29, delayed_balance=0.0, max_balance=175000.0, trade_max_balance=157500.0)

get_my_inventory(app_id: str, context_id: str, delay: int = 3) -> dict:

The response is the same as get_partner_inventory

get_wallet_balance(self, full_data: bool = False) -> Union[float, dict]:

full_data:

{'wallet_currency': 5, 'wallet_country': 'RU', 'wallet_state': '', 'wallet_fee': '1', 'wallet_fee_minimum': '1', 'wallet_fee_percent': '0.05', 'wallet_publisher_fee_percent_default': '0.10', 'wallet_fee_base': '0', 'wallet_balance': '217328', 'wallet_delayed_balance': '10231', 'wallet_max_balance': '17500000', 'wallet_trade_max_balance': '15750000', 'success': 1, 'rwgrsn': -2}

send_offer_with_url(my_assets: dict, them_assets: dict, trade_offer_url: str, message: str = '') -> dict

my_assets and them_assets need send in format returned in functions what get inventories:

[
    '12176056772': {
        'amount': '1',
        'appid': 440,
        'contextid': '2',
        ...
    }
]

response example:

{'tradeofferid': '5583701352', 'needs_mobile_confirmation': True, 'needs_email_confirmation': False, 'email_domain': 'google.com'}

ConfirmationExecutor Methods

get_confirmations() -> list[Confirmation]

confirmations = steam_client.confirmations.get_confirmations()
print(confirmations) # [Confirmation: Sell - IDF, Confirmation: Sell - SWAT]

From Confirmation class you can get various details:

first_confirmation = confirmations[0]
print(first_confirmation.conf_id) # 11360346824
print(first_confirmation.conf_type) # 3
print(first_confirmation.data_accept) # Create Listing
print(first_confirmation.creator) # 3792607079523295593
print(first_confirmation.key) # 9359661368473990051
print(first_confirmation.title) # Sell - IDF
print(first_confirmation.receiving) # 200 pуб. (173,92 pуб.)
print(first_confirmation.time) # Just now
print(first_confirmation.icon) # https://community.akamai.steamstatic.com/economy/image/Iz...fKf/32fx32f

respond_to_confirmations(confirmations: Iterable[Confirmation], cancel: bool = False) -> bool

status = steam_client.confirmations.respond_to_confirmations(confirmations)
print(status) # True

respond_to_confirmation(confirmation: Confirmation, cancel: bool = False) -> bool

first_confirmation = confirmations[0]
status = steam_client.confirmations.respond_to_confirmation(first_confirmation)
print(status) # True

allow_all_confirmations(types: Iterable[ConfirmationType], delay: int = 3) -> None

guard module functions

generate_one_time_code(shared_secret: str) -> str

from steamcom.guard import generate_one_time_code


secret_code = generate_one_time_code(shared_secret)
print(secret_code) # KPI21

generate_confirmation_key(identity_secret: str, tag: str) -> bytes

generate_device_id(steam_id: str) -> str

market module functions

get_price_history(app_id: str, market_hash_name: str) -> dict

Return parsed graph dots:

{
    'Oct 05 2022': {
        '21': {'price': 99.435, 'sales': 43},
        '22': {'price': 139.317, 'sales': 270},
        '23': {'price': 162.369, 'sales': 480}
    },
    'Oct 06 2022': {
        '00': {'price': 136.98, 'sales': 1591},
        '01': {'price': 95.765, 'sales': 2486},
        '02': {'price': 128.912, 'sales': 1166},
        '03': {'price': 79.4, 'sales': 3488},
        '04': {'price': 64.853, 'sales': 3509},
        '05': {'price': 48.488, 'sales': 3615},
        '06': {'price': 38.628, 'sales': 4189},
        '07': {'price': 19.867, 'sales': 5858},
        '08': {'price': 14.915, 'sales': 4695},
        '09': {'price': 17.805, 'sales': 3632},
        '10': {'price': 36.602, 'sales': 2347},
        '11': {'price': 39.764, 'sales': 2222},
        '12': {'price': 38.924, 'sales': 2625},
        '13': {'price': 29.821, 'sales': 2613},
        '14': {'price': 29.942, 'sales': 1829},
        '15': {'price': 41.774, 'sales': 1553},
        '16': {'price': 54.72, 'sales': 1312},
        '17': {'price': 77.849, 'sales': 725},
        '18': {'price': 93.34, 'sales': 584},
        '19': {'price': 85.461, 'sales': 668},
        '20': {'price': 87.43, 'sales': 747},
        '21': {'price': 89.098, 'sales': 744},
        '22': {'price': 98.189, 'sales': 1210},
        '23': {'price': 58.792, 'sales': 2255}
    },
    'Oct 07 2022': {
        '00': {'price': 53.943, 'sales': 3456},
        '01': {'price': 48.988, 'sales': 3294},
        '02': {'price': 44.246, 'sales': 3292},
        '03': {'price': 44.246, 'sales': 3058},
        '04': {'price': 47.308, 'sales': 2573},
        '05': {'price': 30.305, 'sales': 3619},
        '06': {'price': 18.789, 'sales': 5698}
    }
}

get_orders_histogram(item_name_id: str, app_id: str, market_hash_name: str, currency_id: int = None) -> dict

Return parsed histogram dots:

{'buy_order_graph': [
    {'price': 2.67, 'quantity': 1},
    {'price': 2.66, 'quantity': 1},
    {'price': 2.6, 'quantity': 4},
    {'price': 2.57, 'quantity': 23},
    {'price': 2.54, 'quantity': 20},
    {'price': 2.5, 'quantity': 1},
    {'price': 2.49, 'quantity': 1},
    {'price': 2.02, 'quantity': 3},
    {'price': 1.92, 'quantity': 9},
    {'price': 1.74, 'quantity': 15},
    {'price': 1.65, 'quantity': 1},
    {'price': 1.53, 'quantity': 2},
    {'price': 1.4, 'quantity': 1},
    {'price': 1.3, 'quantity': 9},
    {'price': 1.24, 'quantity': 1},
    {'price': 1, 'quantity': 15},
    {'price': 0.87, 'quantity': 97}],
 'sell_order_graph': [
    {'price': 3.24, 'quantity': 1},
    {'price': 3.25, 'quantity': 1},
    {'price': 3.27, 'quantity': 1},
    {'price': 3.28, 'quantity': 4},
    {'price': 3.29, 'quantity': 2},
    {'price': 3.3, 'quantity': 15},
    {'price': 3.33, 'quantity': 1},
    {'price': 3.34, 'quantity': 3},
    {'price': 3.35, 'quantity': 1},
    {'price': 3.36, 'quantity': 2},
    {'price': 3.38, 'quantity': 1},
    {'price': 3.41, 'quantity': 4},
    {'price': 3.42, 'quantity': 1},
    {'price': 3.45, 'quantity': 36},
    {'price': 3.49, 'quantity': 2},
    {'price': 3.5, 'quantity': 1},
    {'price': 3.52, 'quantity': 1},
    {'price': 3.56, 'quantity': 2}]}

get_my_market_listings(self, delay: int = 3) -> dict

Return listings

{'buy_orders': {
    '5470862660': {
        'item_link': 'https://steamcommunity.com/market/listings/570/Seething%20Orbit',
        'item_name': 'Seething Orbit',
        'market_hash_name': 'Seething Orbit',
        'order_id': '5470862660',
        'price': 6.65,
        'quantity': 5}
    },
 'sell_listings': {
    '3868053667603823025': {
        'buyer_pay': 2.70,
        'created_on': '3 Oct',
        'created_timestamp': 1664733600,
        'description': {
            'amount': '1',
            'app_icon': ...,
            'appid': 570,
            'background_color': '',
            'classid': '521521104',
            'commodity': 0,
            'contextid': '2',
            'currency': 0,
            'descriptions': ...
            'icon_url': ...
            'id': '24699743025',
            'instanceid': '5017446107',
            'market_hash_name': 'Lesser Twin',
            'market_marketable_restriction': 0,
            'market_name': 'Lesser Twin Blade',
            'market_tradable_restriction': 7,
            'marketable': 1,
            'name': 'Lesser Twin Blade',
            'name_color': 'D2D2D2',
            'original_amount': '1',
            'owner': 0,
            'owner_descriptions': ...,
            'status': 2,
            'tradable': 0,
            'type': 'Rare Offhand',
            'unowned_contextid': '2',
            'unowned_id': ...},
        'listing_id': '3868053667603823025',
        'need_confirmation': False,
        'you_receive': '2.36'
    }
}

create_buy_order(app_id: str, market_hash_name: str, price_single_item: str, quantity: int, confirm: bool = True) -> dict:

Reponse

{'success': 1, 'buy_orderid': '5465633972'}

create_sell_order(asset_id: str, app_id: str, context_id: str, money_to_receive: str, amount: int = 1) -> dict:

Response

{
    'email_domain': 'gmail.com',
    'needs_email_confirmation': False,
    'needs_mobile_confirmation': True,
    'requires_confirmation': 1,
    'success': True
}

cancel_sell_order(sell_listing_id: str) -> None:

cancel_buy_order(buy_order_id) -> dict:

Response

{'success': 1}

check_placed_buy_order(app_id: str, market_hash_name: str) -> None | dict:

Response

{
    'item_link': 'https://steamcommunity.com/market/listings/570/Seething%20Orbit',
    'item_name': 'Seething Orbit',
    'market_hash_name': 'Seething Orbit',
    'order_id': '5470862660',
    'price': 6.65,
    'quantity': 5
}

get_my_history(events_value: int = 5000, delay: int = 3) -> dict:

Response

[
    {
        'asset': {
            'actions': ...,
            'amount': '0',
            'app_icon': ...
            'appid': 730,
            'background_color': '',
            'classid': '4839651026',
            'commodity': 1,
            'contextid': '2',
            'currency': 0,
            'descriptions': [...],
            'icon_url': ...,
            'icon_url_large': ...,
            'id': '25979127616',
            'instanceid': '188530139',
            'market_actions': [...],
            'market_hash_name': 'Sticker | jabbi (Glitter) | Antwerp 2022',
            'market_name': 'Sticker | jabbi (Glitter) | Antwerp 2022',
            'market_tradable_restriction': 7,
            'marketable': 1,
            'name': 'Sticker | jabbi (Glitter) | Antwerp 2022',
            'name_color': 'D2D2D2',
            'original_amount': '1',
            'owner': 0,
            'status': 4,
            'tradable': 1,
            'type': 'Remarkable Sticker',
            'unowned_contextid': '2',
            'unowned_id': '25979127616'},
        'currency_id': '2005',
        'date_event': '13 Oct',
        'event_type': 4,
        'listingid': '5152706284695898110',
        'new_asset_id': '27404075264',   # from sold and purchased
        'partner_currency_id': '2005',  # from sold and purchased
        'price': 1.5,
        'purchaseid': '5152706284695898111',
        'steamid_actor': '76561199216758062',
        'time_event': 1665657537,
        'time_event_fraction': 310000000
    }
]

get_my_history_up_to_date(self, date: datetime, delay: int = 3, attempts: int = 3) -> dict

The response is the same as get_my_history

fee_counter module functions

calculate_seller_price(self, buyer_price: float) -> FeePrice

Reponse

>>> steam_client.fee_counter.calculate_seller_price(100)
FeePrice(buyer_pay=10000, seller_receive=8697)

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

steamcom-1.2.41.tar.gz (21.9 kB view details)

Uploaded Source

Built Distribution

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

steamcom-1.2.41-py3-none-any.whl (23.9 kB view details)

Uploaded Python 3

File details

Details for the file steamcom-1.2.41.tar.gz.

File metadata

  • Download URL: steamcom-1.2.41.tar.gz
  • Upload date:
  • Size: 21.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for steamcom-1.2.41.tar.gz
Algorithm Hash digest
SHA256 adbb94306af55864bc4ce46e22c86720a00e11e586e341cbfbaa86ef833eb65f
MD5 090ef8ba7b91879738ccbc2a39b38285
BLAKE2b-256 85c43e60762f4111c301b3fbae62dec6ea9b09b00bd0d15dd0c7caa23b8cc135

See more details on using hashes here.

File details

Details for the file steamcom-1.2.41-py3-none-any.whl.

File metadata

  • Download URL: steamcom-1.2.41-py3-none-any.whl
  • Upload date:
  • Size: 23.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for steamcom-1.2.41-py3-none-any.whl
Algorithm Hash digest
SHA256 96a8f8921b1bf04270ee0bad93d7ff6f3c7ef2bd0e1b26a06c4a728bc02b178a
MD5 93b627bdcf590c2886bb48d5bcd8e67c
BLAKE2b-256 158f72163c891f1ab495fcd6d4c49897933c7311430c881f9bb44644d557c2f2

See more details on using hashes here.

Release history Release notifications | RSS feed

1.2.42

2 files

This release

1.2.41 This release

2 files

1.2.40

2 files

1.2.39

2 files

1.2.38

2 files

1.2.37

2 files

1.2.36

2 files

1.2.35

2 files

1.2.34

2 files

1.2.33

2 files

1.2.32

2 files

1.2.31

2 files

1.2.30

2 files

1.2.29

2 files

1.2.28

2 files

1.2.27

2 files

1.2.26

2 files

1.2.25

2 files

1.2.24

2 files

1.2.23

2 files

1.2.22

2 files

1.2.21

2 files

1.2.20

2 files

1.2.19

2 files

1.2.18

2 files

1.2.17

2 files

1.2.16

2 files

1.2.15

2 files

1.2.14

2 files

1.2.13

2 files

1.2.12

2 files

1.2.11

2 files

1.2.8

2 files

1.2.7

2 files

1.2.6

2 files

1.2.5

2 files

1.2.4

2 files

1.2.3

2 files

1.2.2

2 files

1.2.1

2 files

1.2.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page