{"id":13689167,"url":"https://github.com/bukson/steampy","last_synced_at":"2025-05-14T11:10:56.289Z","repository":{"id":38403829,"uuid":"64595205","full_name":"bukson/steampy","owner":"bukson","description":"A Steam trading library for python 3","archived":false,"fork":false,"pushed_at":"2024-12-23T22:20:02.000Z","size":197,"stargazers_count":621,"open_issues_count":83,"forks_count":160,"subscribers_count":23,"default_branch":"master","last_synced_at":"2025-05-10T12:08:47.342Z","etag":null,"topics":["linux","macos","python","python3","steam","steam-api","steam-market","steam-trade-offers","steamguard","windows"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bukson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-07-31T13:29:20.000Z","updated_at":"2025-05-04T05:17:53.000Z","dependencies_parsed_at":"2024-01-09T13:55:25.156Z","dependency_job_id":"231a1a93-75cc-460e-a1ce-dc1c5b05187f","html_url":"https://github.com/bukson/steampy","commit_stats":{"total_commits":118,"total_committers":28,"mean_commits":4.214285714285714,"dds":0.4152542372881356,"last_synced_commit":"d8af9472526492c572e398778b915218ca316762"},"previous_names":[],"tags_count":55,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bukson%2Fsteampy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bukson%2Fsteampy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bukson%2Fsteampy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bukson%2Fsteampy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bukson","download_url":"https://codeload.github.com/bukson/steampy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254129491,"owners_count":22019628,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["linux","macos","python","python3","steam","steam-api","steam-market","steam-trade-offers","steamguard","windows"],"created_at":"2024-08-02T15:01:36.463Z","updated_at":"2025-05-14T11:10:56.263Z","avatar_url":"https://github.com/bukson.png","language":"Python","readme":"Steam Trade Offers Client for Python\n=======\n\n[![PayPal Donate Button](https://img.shields.io/badge/donate-paypal-orange.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=XC8BMJ8QRD9ZY \"Donate to this project via PayPal\")\n\nDonate bitcoin: 3PRzESHsTVkCFK7osjwFGQLZjSf7qXP1Ta \n\n`steampy` is a library for Python, inspired by node-steam-tradeoffers, node-steam and other libraries for Node.js.\nIt was designed as a simple lightweight library, combining features of many steam libraries from Node.js into a single python module.\n`steampy` is capable of logging into steam, fetching trade offers and handling them in simple manner, using steam user credentials\nand SteamGuard file, or by passing sessionID and webCookie cookies. \n'steampy' is also capable of using proxies.\n`steampy` is developed with Python 3 using type hints and many other features its supported for Windows, Linux and MacOs.\n\nTable of Content\n================\n\n* [Installation](https://github.com/bukson/steampy#installation)\n\n* [Usage](https://github.com/bukson/steampy#usage)\n\n* [Examples](https://github.com/bukson/steampy#examples)\n\n* [SteamClient methods](https://github.com/bukson/steampy#steamclient-methods)\n\n* [Market methods](https://github.com/bukson/steampy#market-methods)\n\n* [Guard module functions](https://github.com/bukson/steampy#guard-module-functions)\n\n* [Utils methods](https://github.com/bukson/steampy#utils-methods)\n\n* [Test](https://github.com/bukson/steampy#test)\n\n* [License](https://github.com/bukson/steampy#license)\n\n\nInstallation\n============\n\nRequires python 3.12 at least\n```\npip install steampy\n```\n\nUsage\n=======\n[Obtaining API Key](http://steamcommunity.com/dev/apikey)\n\n[Obtaining SteamGuard from mobile device]( https://github.com/SteamTimeIdler/stidler/wiki/Getting-your-%27shared_secret%27-code-for-use-with-Auto-Restarter-on-Mobile-Authentication )\n\n[Obtaining SteamGuard using Android emulation]( https://github.com/codepath/android_guides/wiki/Genymotion-2.0-Emulators-with-Google-Play-support)\n\n** __init__(self, api_key: str, username: str = None, password: str = None, steam_guard: str = None,\n                 login_cookies: dict = None, proxies: dict = None) -\u003e None:**\n\n\nSteamClient needs at least api_key to provide some functionalities. User can also provide username, password\nand SteamGuard file to be able to log in and use more methods. Proxies are also supported.\n\n```python\nfrom steampy.client import SteamClient\n\nsteam_client = SteamClient('MY_API_KEY')\nsteam_client.login('MY_USERNAME', 'MY_PASSWORD', 'PATH_TO_STEAMGUARD_FILE')\n```\n\nUser can also provide login_cookies from browser to log in by cookies.\n\n```python\nfrom steampy.client import SteamClient\n\nlogin_cookies = {} # provide dict with cookies\nsteam_client = SteamClient('MY_API_KEY',username='MY_USERNAME',login_cookies=login_cookies)\nassert steam_client.was_login_executed\n```\n\n`proxies` dict can be provided for using proxy for internal SteamClient session.\n\n```python\nfrom steampy.client import SteamClient\n\nproxies =  {\n    \"http\": \"http://login:password@host:port\", \n    \"https\": \"http://login:password@host:port\"\n}\n\nsteam_client = SteamClient('MY_API_KEY', proxies=proxies)\n\n```\n\n\n\nIf you have `steamid`, `shared_secret` and `identity_secret` you can place it in file `Steamguard.txt` instead of fetching SteamGuard file from device.\n```python\n{\n    \"steamid\": \"YOUR_STEAM_ID_64\",\n    \"shared_secret\": \"YOUR_SHARED_SECRET\",\n    \"identity_secret\": \"YOUR_IDENTITY_SECRET\"\n}\n```\n\nExamples\n========\n\nYou'll need to obtain your API key and SteamGuard file in order to run the examples, \nand then fill login and password in `storehose.py` file.\nThe `storehouse.py` file contains an example of handling incoming trade offers.\n\n```\npython storehouse.py\n```\n\nIf you want to generate authentication codes and use steampy as steam desktop authenticator\nthen fill required secrets in `desktop_authenticator.py` file.\nThe `desktop_authenticator.py` file contains examples of generating such one time codes/\n\n```\npython desktop_authenticator.py\n```\n\n\nSteamClient methods\n===================\n\nUnless specified in documentation, the method does not require login to work(it uses API Key from constructor instead)\n\n**def set_proxy(self, proxy: dict) -\u003e dict**\n\nSet proxy for steampy session, example: \n\n```python\nfrom steampy.client import SteamClient\n\nsteam_client = SteamClient('MY_API_KEY')\nproxies =  {\n    \"http\": \"http://login:password@host:port\", \n    \"https\": \"http://login:password@host:port\"\n}\nsteam_client.set_proxies(proxies)\n\n```\n\n**def set_login_cookies(self, cookies: dict) -\u003e None**\n\nSet login cookies, can be used instead of normal `login` method.\n\n```python\nfrom steampy.client import SteamClient\n\nlogin_cookies = {} # provide dict with cookies\nsteam_client = SteamClient('MY_API_KEY',username='MY_USERNAME',login_cookies=login_cookies)\nassert steam_client.was_login_executed\n```\n\n**login(username: str, password: str, steam_guard: str) -\u003e requests.Response**\n\nLog into the steam account. Allows to accept trade offers and some other methods.\n\n```python\nfrom steampy.client import SteamClient\n\nsteam_client = SteamClient('MY_API_KEY')\nsteam_client.login('MY_USERNAME', 'MY_PASSWORD', 'PATH_TO_STEAMGUARD_FILE')\n```\n\nYou can also use `with` statement to automatically login and logout.\n\n```python\nfrom steampy.client import SteamClient\n\nwith SteamClient('MY_API_KEY', 'MY_USERNAME', 'MY_PASSWORD', 'PATH_TO_STEAMGUARD_FILE') as client:\n    client.some_method1(...)\n    client.some_method2(...)\n    ...\n```\n\n**logout() -\u003e None**\n\nUsing `SteamClient.login` method is required before usage\nLogout from steam.\n\n```python\nfrom steampy.client import SteamClient\n\nsteam_client = SteamClient('MY_API_KEY')\nsteam_client.login('MY_USERNAME', 'MY_PASSWORD', 'PATH_TO_STEAMGUARD_FILE')\nsteam_client.logout()\n```\n\nYou can also use `with` statement to automatically login and logout.\n\n```python\nfrom steampy.client import SteamClient\n\nwith SteamClient('MY_API_KEY', 'MY_USERNAME', 'MY_PASSWORD', 'PATH_TO_STEAMGUARD_FILE') as client:\n    client.some_method1(...)\n    client.some_method2(...)\n    ...\n```\n\n**is_session_alive() -\u003e None**\n\nUsing `SteamClient.login` method is required before usage\nCheck if session is alive. This method fetches main page and check\nif user name is there. Thanks for vasia123 for this solution.\n\n```python\nfrom steampy.client import SteamClient\n\nsteam_client = SteamClient('MY_API_KEY')\nsteam_client.login('MY_USERNAME', 'MY_PASSWORD', 'PATH_TO_STEAMGUARD_FILE')\nis_session_alive = steam_client.is_session_alive()\n```\n\n**api_call(request_method: str, interface: str, api_method: str, version: str, params: dict = None) -\u003e requests.Response**\n\nDirectly call api method from the steam api services.\n\n[Official steam api site](https://developer.valvesoftware.com/wiki/Steam_Web_API)\n\n[Unofficial but more elegant](https://lab.xpaw.me/steam_api_documentation.html)\n\n```python\nfrom steampy.client import SteamClient\n\nsteam_client = SteamClient('MY_API_KEY')\nparams = {'key': 'MY_API_KEY'}\nsummaries =  steam_client.api_call('GET', 'IEconService', 'GetTradeOffersSummary', 'v1', params).json()\n```\n**get_trade_offers_summary() -\u003e dict**\n\n\n**get_trade_offers(merge: bool = True, get_sent_offers: bool = True, get_received_offers: bool = True, use_webtoken: bool =False, max_retry:int = 5) -\u003e dict**\n\nFetching trade offers from steam using an API call.\nMethod is fetching offers with descriptions that satisfy conditions:\n\n    * Are sent by us or others\n    * Are active (means they have `trade_offer_state` set to 2 (Active))\n    * Are not historical\n    * No time limitation\n\nIf `merge` is set `True` then offer items are merged from items data and items description into dict where items `id` is key\nand descriptions merged with data are value.\n\n`get_sent_offers` and `get_received_offers` control which offers are fetched.\n\n`max_retry` controls how many retries the api call will try.\n\n**get_trade_offer(trade_offer_id: str, merge: bool = True, use_webtoken:bool =False) -\u003e dict**\n\nif `use_webtoken` is True, then request sent will contain access_token instead of api_key\n\n**get_trade_receipt(trade_id: str) -\u003e list**\n\nUsing `SteamClient.login` method is required before usage\nGetting the receipt for a trade with all item information after the items has been traded.\nDo NOT store any item ids before you got the receipt since the ids may change.\n\"trade_id\" can be found in trade offers: `offer['response']['offer']['tradeid']`. Do not use ´tradeofferid´.\n\n\n**make_offer(items_from_me: List[Asset], items_from_them: List[Asset], partner_steam_id: str, message:str ='') -\u003e dict**\n\nUsing `SteamClient.login` method is required before usage\n`Asset` is class defined in `client.py`, you can obtain `asset_id` from `SteamClient.get_my_inventory` method.\nThis method also uses identity secret from SteamGuard file to confirm the trade offer.\nNo need to manually confirm it on mobile app or email.\nThis method works when partner is your friend or steam.\nIn returned dict there will be trade offer id by the key `tradeofferid`.\n\n```python\nfrom steampy.client import SteamClient, Asset\nfrom steampy.utils import GameOptions\n\nsteam_client = SteamClient('MY_API_KEY')\nsteam_client.login('MY_USERNAME', 'MY_PASSWORD', 'PATH_TO_STEAMGUARD_FILE')\npartner_id = 'PARTNER_ID'\ngame = GameOptions.CS\nmy_items = steam_client.get_my_inventory(game)\npartner_items = steam_client.get_partner_inventory(partner_id, game)\nmy_first_item = next(iter(my_items.values()))\npartner_first_item = next(iter(partner_items.values()))\nmy_asset = Asset(my_first_item['id'], game)\npartner_asset = Asset(partner_first_item['id'], game)\nsteam_client.make_offer([my_asset], [partner_asset], partner_id, 'Test offer')\n```\n\n**make_offer_with_url(items_from_me: List[Asset], items_from_them: List[Asset], trade_offer_url: str, message: str = '', case_sensitive: bool = True) -\u003e dict**\n\nUsing `SteamClient.login` method is required before usage\nThis method is similar to `SteamClient.make_offer`, but it takes trade url instead of friend account id.\nIt works even when partner isn't your steam friend\nIn returned dict there will be trade offer id by the key `tradeofferid`.\nIf `case_sensitive` is False, then url params with be parsed with case insensitive params keys.\n\n**get_escrow_duration(trade_offer_url: str) -\u003e int**\n\nUsing `SteamClient.login` method is required before usage\n\nCheck the escrow duration for trade between you and partner(given partner trade offer url)\n\n**accept_trade_offer(trade_offer_id: str) -\u003e dict**\n\nUsing `SteamClient.login` method is required before usage\nThis method also uses identity secret from SteamGuard file to confirm the trade offer.\nNo need to manually confirm it on mobile app or email.\n\n**decline_trade_offer(trade_offer_id: str) -\u003e dict**\n\nDecline trade offer that **other** user sent to us.\n\n**cancel_trade_offer(trade_offer_id: str) -\u003e dict**\n\nCancel trade offer that **we** sent to other user.\n\n**get_my_inventory(game: GameOptions, merge: bool = True, count: int = 5000) -\u003e dict**\n\nUsing `SteamClient.login` method is required before usage\n\nIf `merge` is set `True` then inventory items are merged from items data and items description into dict where items `id` is key\nand descriptions merged with data are value.\n\n`Count` parameter is default max number of items, that can be fetched.\n\nInventory entries looks like this:\n\n```python\ninventory_entry = {'7146788981': {'actions': [{\n                                      'link': 'steam://rungame/730/76561202255233023/+csgo_econ_action_preview%20S%owner_steamid%A%assetid%D316070896107169653',\n                                      'name': 'Inspect in Game...'}],\n                      'amount': '1',\n                      'appid': '730',\n                      'background_color': '',\n                      'classid': '1304827205',\n                      'commodity': 0,\n                      'contextid': '2',\n                      'descriptions': [{'type': 'html',\n                                        'value': 'Exterior: Field-Tested'},\n                                       {'type': 'html', 'value': ' '},\n                                       {'type': 'html',\n                                        'value': 'Powerful and reliable, the AK-47 '\n                                                 'is one of the most popular assault '\n                                                 'rifles in the world. It is most '\n                                                 'deadly in short, controlled bursts '\n                                                 'of fire. It has been painted using '\n                                                 'a carbon fiber hydrographic and a '\n                                                 'dry-transfer decal of a red '\n                                                 'pinstripe.\\n'\n                                                 '\\n'\n                                                 '\u003ci\u003eNever be afraid to push it to '\n                                                 'the limit\u003c/i\u003e'},\n                                       {'type': 'html', 'value': ' '},\n                                       {'app_data': {'def_index': '65535',\n                                                     'is_itemset_name': 1},\n                                        'color': '9da1a9',\n                                        'type': 'html',\n                                        'value': 'The Phoenix Collection'},\n                                       {'type': 'html', 'value': ' '},\n                                       {'app_data': {'def_index': '65535'},\n                                        'type': 'html',\n                                        'value': '\u003cbr\u003e\u003cdiv id=\"sticker_info\" '\n                                                 'name=\"sticker_info\" title=\"Sticker '\n                                                 'Details\" style=\"border: 2px solid '\n                                                 'rgb(102, 102, 102); border-radius: '\n                                                 '6px; width=100; margin:4px; '\n                                                 'padding:8px;\"\u003e\u003ccenter\u003e\u003cimg '\n                                                 'width=64 height=48 '\n                                                 'src=\"https://steamcdn-a.akamaihd.net/apps/730/icons/econ/stickers/eslkatowice2015/pentasports.a6b0ddffefb5507453456c0d2c35b6a57821c171.png\"\u003e\u003cimg '\n                                                 'width=64 height=48 '\n                                                 'src=\"https://steamcdn-a.akamaihd.net/apps/730/icons/econ/stickers/eslkatowice2015/pentasports.a6b0ddffefb5507453456c0d2c35b6a57821c171.png\"\u003e\u003cimg '\n                                                 'width=64 height=48 '\n                                                 'src=\"https://steamcdn-a.akamaihd.net/apps/730/icons/econ/stickers/eslkatowice2015/pentasports.a6b0ddffefb5507453456c0d2c35b6a57821c171.png\"\u003e\u003cimg '\n                                                 'width=64 height=48 '\n                                                 'src=\"https://steamcdn-a.akamaihd.net/apps/730/icons/econ/stickers/cologne2015/mousesports.3e75da497d9f75fa56f463c22db25f29992561ce.png\"\u003e\u003cbr\u003eSticker: '\n                                                 'PENTA Sports  | Katowice 2015, '\n                                                 'PENTA Sports  | Katowice 2015, '\n                                                 'PENTA Sports  | Katowice 2015, '\n                                                 'mousesports | Cologne '\n                                                 '2015\u003c/center\u003e\u003c/div\u003e'}],\n                      'icon_drag_url': '',\n                      'icon_url': '-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KU0Zwwo4NUX4oFJZEHLbXH5ApeO4YmlhxYQknCRvCo04DEVlxkKgpot7HxfDhjxszJemkV09-5lpKKqPrxN7LEmyVQ7MEpiLuSrYmnjQO3-UdsZGHyd4_Bd1RvNQ7T_FDrw-_ng5Pu75iY1zI97bhLsvQz',\n                      'icon_url_large': '-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KU0Zwwo4NUX4oFJZEHLbXH5ApeO4YmlhxYQknCRvCo04DEVlxkKgpot7HxfDhjxszJemkV09-5lpKKqPrxN7LEm1Rd6dd2j6eQ9N2t2wK3-ENsZ23wcIKRdQE2NwyD_FK_kLq9gJDu7p_KyyRr7nNw-z-DyIFJbNUz',\n                      'id': '7146788981',\n                      'instanceid': '480085569',\n                      'market_actions': [{\n                                             'link': 'steam://rungame/730/76561202255233023/+csgo_econ_action_preview%20M%listingid%A%assetid%D316070896107169653',\n                                             'name': 'Inspect in Game...'}],\n                      'market_hash_name': 'AK-47 | Redline (Field-Tested)',\n                      'market_name': 'AK-47 | Redline (Field-Tested)',\n                      'market_tradable_restriction': '7',\n                      'marketable': 1,\n                      'name': 'AK-47 | Redline',\n                      'name_color': 'D2D2D2',\n                      'owner_descriptions': '',\n                      'tags': [{'category': 'Type',\n                                'category_name': 'Type',\n                                'internal_name': 'CSGO_Type_Rifle',\n                                'name': 'Rifle'},\n                               {'category': 'Weapon',\n                                'category_name': 'Weapon',\n                                'internal_name': 'weapon_ak47',\n                                'name': 'AK-47'},\n                               {'category': 'ItemSet',\n                                'category_name': 'Collection',\n                                'internal_name': 'set_community_2',\n                                'name': 'The Phoenix Collection'},\n                               {'category': 'Quality',\n                                'category_name': 'Category',\n                                'internal_name': 'normal',\n                                'name': 'Normal'},\n                               {'category': 'Rarity',\n                                'category_name': 'Quality',\n                                'color': 'd32ce6',\n                                'internal_name': 'Rarity_Legendary_Weapon',\n                                'name': 'Classified'},\n                               {'category': 'Exterior',\n                                'category_name': 'Exterior',\n                                'internal_name': 'WearCategory2',\n                                'name': 'Field-Tested'},\n                               {'category': 'Tournament',\n                                'category_name': 'Tournament',\n                                'internal_name': 'Tournament6',\n                                'name': '2015 ESL One Katowice'},\n                               {'category': 'Tournament',\n                                'category_name': 'Tournament',\n                                'internal_name': 'Tournament7',\n                                'name': '2015 ESL One Cologne'},\n                               {'category': 'TournamentTeam',\n                                'category_name': 'Team',\n                                'internal_name': 'Team39',\n                                'name': 'PENTA Sports'},\n                               {'category': 'TournamentTeam',\n                                'category_name': 'Team',\n                                'internal_name': 'Team29',\n                                'name': 'mousesports'}],\n                      'tradable': 1,\n                      'type': 'Classified Rifle'}}\n```\n\n**get_partner_inventory(partner_steam_id: str, game: GameOptions, merge: bool = True, count: int = 5000) -\u003e dict**\n\nUsing `SteamClient.login` method is required before usage\n\nInventory items can be merged like in `SteamClient.get_my_inventory` method\n\n`Count` parameter is default max number of items, that can be fetched.\n\n**get_wallet_balance(convert_to_decimal: bool = True, on_hold: bool = False) -\u003e Union[str, float]**\n\nCheck account balance of steam acccount. It converts money string to Decimal if `convert_to_decimal` is set to `True`, \notherwise, it will return the value string without a decimal point.\nIf the `on_hold` parameter is set to `True`, it will return the current on-hold balance value.\n\nExample:\n```python\nfrom steampy.client import SteamClient\nfrom decimal import Decimal \nwith SteamClient('MY_API_KEY', 'MY_USERNAME', 'MY_PASSWORD', 'PATH_TO_STEAMGUARD_FILE') as client:\n            wallet_balance = client.get_wallet_balance()\n            on_hold_wallet_balance = client.get_wallet_balance(on_hold = True)\n            assert type(wallet_balance) == Decimal\n            assert type(on_hold_wallet_balance) == Decimal\n```\n\nmarket methods\n==============\n\n**fetch_price(item_hash_name: str, game: GameOptions, currency: str = Currency.USD) -\u003e dict**\n\nSome games are predefined in `GameOptions` class, such as `GameOptions.DOTA2`, `GameOptions.CS` and `GameOptions.TF2,\nbut `GameOptions` object can be constructed with custom parameters.\n\nCurrencies are defined in Currency class, [currently](https://github.com/bukson/steampy#currencies)\n\nDefault currency is USD\n\nMay rise `TooManyRequests` exception if used more than 20 times in 60 seconds.\n\n```python\nfrom steampy.client import SteamClient\nfrom steampy.models import GameOptions\n\nsteam_client = SteamClient('API_KEY')\nitem = 'M4A1-S | Cyrex (Factory New)'\nprice = steam_client.market.fetch_price(item, game=GameOptions.CS)\n# price == {'volume': '208', 'lowest_price': '$11.30 USD', 'median_price': '$11.33 USD', 'success': True}\n```\n\n**fetch_price_history(item_hash_name: str, game: GameOptions) -\u003e dict**\n\nUsing `SteamClient.login` method is required before usage\n\nReturns list of price history of and item.\n```python\nfrom steampy.client import SteamClient\nfrom steampy.models import GameOptions\n\nwith SteamClient('MY_API_KEY', 'MY_USERNAME', 'MY_PASSWORD', 'PATH_TO_STEAMGUARD_FILE') as client:\n    item = 'M4A1-S | Cyrex (Factory New)'\n    response = client.market.fetch_price_history(item, GameOptions.CS)\n    response['prices'][0]\n    ['Jul 02 2014 01: +0', 417.777, '40']\n```\n\nEach entry in `response['prices']` is a list, with first entry being date, second entry price, and third entry a volume.\n\n**get_my_market_listings() -\u003e dict**\n\nUsing `SteamClient.login` method is required before usage\n\nReturns market listings posted by user\n\n```python\nfrom steampy.client import SteamClient\n\nwith SteamClient('MY_API_KEY', 'MY_USERNAME', 'MY_PASSWORD', 'PATH_TO_STEAMGUARD_FILE') as client:\n    listings = client.market.get_my_market_listings()\n```\n\n\n**create_sell_order(assetid: str, game: GameOptions, money_to_receive: str) -\u003e dict**\n\nUsing `SteamClient.login` method is required before usage\n\nCreate sell order of the asset on the steam market.\n\n```python\nfrom steampy.client import SteamClient\nfrom steampy.models import GameOptions\n\nwith SteamClient('MY_API_KEY', 'MY_USERNAME', 'MY_PASSWORD', 'PATH_TO_STEAMGUARD_FILE') as client:\n    asset_id_to_sell = 'some_asset_id'\n    game = GameOptions.DOTA2\n    sell_response = client.market.create_sell_order(asset_id_to_sell, game, \"10000\")\n```\n \n⚠️ `money_to_receive` has to be in cents, so \"100.00\" should be passed has \"10000\"\n\n**create_buy_order(market_name: str, price_single_item: str, quantity: int, game: GameOptions, currency: Currency = Currency.USD) -\u003e dict**\n\nUsing `SteamClient.login` method is required before usage\n\nCreate buy order of the assets on the steam market.\n\n```python\nfrom steampy.client import SteamClient\nfrom steampy.models import GameOptions, Currency\n\nwith SteamClient('MY_API_KEY', 'MY_USERNAME', 'MY_PASSWORD', 'PATH_TO_STEAMGUARD_FILE') as client:\n    response = client.market.create_buy_order(\"AK-47 | Redline (Field-Tested)\", \"1034\", 2, GameOptions.CS, Currency.EURO)\n    buy_order_id = response[\"buy_orderid\"]\n```\n⚠️ `price_single_item` has to be in cents, so \"10.34\" should be passed has \"1034\"\n\n**buy_item(market_name: str, market_id: str, price: int, fee: int, game: GameOptions, currency: Currency = Currency.USD) -\u003e dict**\n\nUsing `SteamClient.login` method is required before usage\n\nBuy a certain item from market listing.\n\n```python\nfrom steampy.client import SteamClient\nfrom steampy.models import Currency, GameOptions\n\nwith SteamClient('MY_API_KEY', 'MY_USERNAME', 'MY_PASSWORD', 'PATH_TO_STEAMGUARD_FILE') as client:\n    response = client.market.buy_item('AK-47 | Redline (Field-Tested)', '1942659007774983251', 81, 10,\n                                        GameOptions.CS, Currency.RUB)\n    wallet_balance = response[\"wallet_info\"][\"wallet_balance\"]\n```\n\n**cancel_sell_order(sell_listing_id: str) -\u003e None**\n\nUsing `SteamClient.login` method is required before usage\n\nCancel previously requested sell order on steam market.\n\n```python\nfrom steampy.client import SteamClient\n\nwith SteamClient('MY_API_KEY', 'MY_USERNAME', 'MY_PASSWORD', 'PATH_TO_STEAMGUARD_FILE') as client:\n    sell_order_id = \"some_sell_order_id\"\n    response = client.market.cancel_sell_order(sell_order_id)\n```\n\n**cancel_buy_order(buy_order_id) -\u003e dict**\n\nUsing `SteamClient.login` method is required before usage\n\nCancel previously requested buy order on steam market.\n\n```python\nfrom steampy.client import SteamClient\n\nwith SteamClient('MY_API_KEY', 'MY_USERNAME', 'MY_PASSWORD', 'PATH_TO_STEAMGUARD_FILE') as client:\n    buy_order_id = \"some_buy_order_id\"\n    response = client.market.cancel_buy_order(buy_order_id)\n```\n\nCurrencies\n----------\n\n| Currency class | Description                 |\n| ---            | ---                         |\n| Currency.USD   | United States Dollar        |\n| Currency.GBP   | United Kingdom Pound        |\n| Currency.EURO  | European Union Euro         |\n| Currency.CHF   | Swiss Francs                |\n| Currency.RUB   | Russian Rouble              |\n| Currency.PLN   | Polish Złoty                |\n| Currency.BRL   | Brazilian Reals             |\n| Currency.JPY   | Japanese Yen                |\n| Currency.NOK   | Norwegian Krone             |\n| Currency.IDR   | Indonesian Rupiah           |\n| Currency.MYR   | Malaysian Ringgit           |\n| Currency.PHP   | Philippine Peso             |\n| Currency.SGD   | Singapore Dollar            |\n| Currency.THB   | Thai Baht                   |\n| Currency.VND   | Vietnamese Dong             |\n| Currency.KRW   | South Korean Won            |\n| Currency.TRY   | Turkish Lira                |\n| Currency.UAH   | Ukrainian Hryvnia           |\n| Currency.MXN   | Mexican Peso                |\n| Currency.CAD   | Canadian Dollars            |\n| Currency.AUD   | Australian Dollars          |\n| Currency.NZD   | New Zealand Dollar          |\n| Currency.CNY   | Chinese Renminbi (yuan)     |\n| Currency.INR   | Indian Rupee                |\n| Currency.CLP   | Chilean Peso                |\n| Currency.PEN   | Peruvian Sol                |\n| Currency.COP   | Colombian Peso              |\n| Currency.ZAR   | South African Rand          |\n| Currency.HKD   | Hong Kong Dollar            |\n| Currency.TWD   | New Taiwan Dollar           |\n| Currency.SAR   | Saudi Riyal                 |\n| Currency.AED   | United Arab Emirates Dirham |\n| Currency.SEK   | Swedish Krona               |\n| Currency.ARS   | Argentine Peso              |\n| Currency.ILS   | Israeli New Shekel          |\n| Currency.BYN   | Belarusian Ruble            |\n| Currency.KZT   | Kazakhstani Tenge           |\n| Currency.KWD   | Kuwaiti Dinar               |\n| Currency.QAR   | Qatari Riyal                |\n| Currency.CRC   | Costa Rican Colón           |\n| Currency.UYU   | Uruguayan Peso              |\n| Currency.BGN   | Bulgarian Lev               |\n| Currency.HRK   | Croatian Kuna               |\n| Currency.CZK   | Czech Koruna                |\n| Currency.DKK   | Danish Krone                |\n| Currency.HUF   | Hungarian Forint            |\n| Currency.RON   | Romanian Leu                |\n\nguard module functions\n======================\n\n**load_steam_guard(steam_guard: str) -\u003e dict**\n\nIf `steam_guard` is file name then load and parse it, else just parse `steam_guard` as json string.\n\n**generate_one_time_code(shared_secret: str, timestamp: int = None) -\u003e str**\n\nGenerate one time code for logging into Steam using shared_secret from SteamGuard file.\nIf none timestamp provided, timestamp will be set to current time.\n\n**generate_confirmation_key(identity_secret: str, tag: str, timestamp: int = int(time.time())) -\u003e bytes**\n\nGenerate mobile device confirmation key for accepting trade offer. \nDefault timestamp is current time.\n\n\nUtils methods\n======================\n\n**calculate_gross_price(price_net: Decimal, publisher_fee: Decimal, steam_fee: Decimal = Decimal('0.05')) -\u003e Decimal:**\n\nCalculate the price including the publisher's fee and the Steam fee. Most publishers have a `10%` fee with a minimum \nfee of `$0.01`. The Steam fee is currently `5%` (with a minimum fee of `$0.01`) and may be increased or decreased by \nSteam in the future.\n\nReturns the amount that the buyer pays during a market transaction:\n\n```python\nfrom decimal import Decimal\nfrom steampy.utils import calculate_gross_price\n\npublisher_fee = Decimal('0.1')  # 10%\n\ncalculate_gross_price(Decimal('100'), publisher_fee)     # returns Decimal('115')\n```\n\n**calculate_net_price(price_gross: Decimal, publisher_fee: Decimal, steam_fee: Decimal = Decimal('0.05')) -\u003e Decimal:**\n\nCalculate the price without the publisher's fee and the Steam fee. Most publishers have a `10%` fee with a minimum fee \nof `$0.01`. The Steam fee is currently `5%` (with a minimum fee of `$0.01`) and may be increased or decreased by Steam \nin the future.\n\nReturns the amount that the seller receives after a market transaction:\n\n```python\nfrom decimal import Decimal\nfrom steampy.utils import calculate_net_price\n\npublisher_fee = Decimal('0.1')  # 10%\n\ncalculate_net_price(Decimal('115'), publisher_fee)     # returns Decimal('100')\n```\n\nTest\n====\n\nAll public methods are documented and tested. \n`guard` module has unit tests, `client` uses an acceptance test.\nFor the acceptance test you have to put `credentials.pwd` and `Steamguard` file into `test` directory\n\nExample `credentials.pwd` file:\n\n```\naccount1 password1 api_key1\naccount2 password2 api_key2\n```\n\nIn some tests you also have to obtain `transaction_id`.\nYou can do it by `SteamClient.get_trade_offers` or by logging manually into steam account in browser and get it from url\n\nIn some tests you also have to obtain partner steam id.\nYou can do it by logging manually into steam account in browser and get it from url\n\nLicense\n=======\n\nMIT License\n\nCopyright (c) 2016 [Michał Bukowski](gigibukson@gmail.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","funding_links":["https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=XC8BMJ8QRD9ZY"],"categories":["Python","Packages"],"sub_categories":["Python"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbukson%2Fsteampy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbukson%2Fsteampy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbukson%2Fsteampy/lists"}