steampy icon indicating copy to clipboard operation
steampy copied to clipboard

create_sell_order

Open Spawn944 opened this issue 1 year ago • 3 comments

I'm having an issue creating sell order. How can i fix this?

import steampy
import json
from steampy.client import SteamClient
from steampy.exceptions import ApiException
from steampy.models import GameOptions

username = 'e'
password = 'w'
shared_secret_key = 'U'
API_KEY = '0'
steamid = '7'
identity_secret_key = 'w'

game = GameOptions(context_id=2, app_id=730)
money_to_receive = "25.00"

steamguard_data = {
    "steamid": steamid,
    "shared_secret": shared_secret_key,
    "identity_secret": identity_secret_key
}
steamguard_data = json.dumps(steamguard_data)
steam_client = SteamClient(API_KEY)
item_list_file = r"C:\Users\Kann\Desktop\Steam\Selling\items_for_sale.txt"
success_file = r"C:\Users\Kann\Desktop\Steam\Selling\items_sold_successfully.txt"

try:
    steam_client.login(username, password, steamguard_data)
    print("Successfully logged in to Steam.")

    with open(item_list_file, "r") as file:
        item_list = file.read().splitlines()

    while item_list:
        item = item_list[0] 

        try:
            response = steam_client.market.create_sell_order(item, game, money_to_receive)
            print(response)

            if response and response.get("success"):
                print(f"Successfully sold item: {item}")
                item_list.pop(0)  

                with open(success_file, "a") as success_file:
                    success_file.write(item + "\n")
            elif response and response.get("message"):
                print(f"Error occurred while selling item {item}: {response['message']}")
            else:
                print(f"Unknown error occurred while selling item {item}")

        except ApiException as e:
            print(f"Error occurred while selling item {item}: {e}")

    print("All items sold successfully!")

    with open(item_list_file, "w") as file:
        for item in item_list:
            file.write(item + "\n")

except ApiException as e:
    print(f"Error occurred while logging in to Steam: {e}")
finally:
    steam_client.logout()

output

C:\Users\Kann>python C:\Users\Kann\Desktop\Steam\Selling\sell_testing1.py
Successfully logged in to Steam.
{'success': False, 'message': 'Missing parameters in SellItem request'}
Error occurred while selling item Nova | Sand Dune (Minimal Wear): Missing parameters in SellItem request
{'success': False, 'message': 'Missing parameters in SellItem request'}
Error occurred while selling item Nova | Sand Dune (Minimal Wear): Missing parameters in SellItem request
{'success': False, 'message': 'Missing parameters in SellItem request'}
Error occurred while selling item Nova | Sand Dune (Minimal Wear): Missing parameters in SellItem request
Traceback (most recent call last):
  File "C:\Users\Kann\Desktop\Steam\Selling\sell_testing1.py", line 43, in <module>
    response = steam_client.market.create_sell_order(item, game, money_to_receive) 

Spawn944 avatar Jul 02 '23 06:07 Spawn944

Related:

  • #227

No clue about that missing parameter though.

woctezuma avatar Jul 12 '23 18:07 woctezuma

Try specifying the game differently game = GameOptions.DOTA2 Instead of item, specify item id

Dandelion101 avatar Sep 11 '23 15:09 Dandelion101

There are two mistakes in your code:

  • money_to_receive must be in cents, not in dollars. So in your case it should be "2500", NOT "25.00"
  • item that you pass to the steam_client.market.create_sell_order(item, game, money_to_receive) is NOT the name of the skin, but an assetid (which can be found when you run steam_client.get_my_inventory(game)).

Here is a sample from steam_client.get_my_inventory(game) in which I highlighted the assetid using arrows — >>assetid<<

{
">>36643205050<<": {
        "appid": 730,
        "classid": "5721076182",
        "instanceid": "188530170",
        ...
        "contextid": "2",
        "id": ">>36643205050<<",
        "amount": "1"
    },
    ">>36643162490<<": {
        "appid": 730,
        "classid": "5721067159",
        "instanceid": "188530139",
        ...
        "contextid": "2",
        "id": ">>36643162490<<",
        "amount": "1"
    }
}

VnykBabyshki avatar Apr 05 '24 08:04 VnykBabyshki