steampy icon indicating copy to clipboard operation
steampy copied to clipboard

Invalid trade offer state: ConfirmationNeed (9) Please help me 🙏 🙏 🙏

Open study657 opened this issue 1 year ago • 4 comments

Hello, dear author. First of all, I would like to thank you for your hard work and the work that you have done, really thank you...

Could you help me? When confirming the SENT offer, I get this error

Traceback (most recent call last): File "c:\Users\User\Desktop\new(3)\main.py", line 5, in steam_client.accept_trade_offer('6628868099') File "C:\Program Files (x86)\Python310\lib\site-packages\steampy\utils.py", line 24, in func_wrapper return func(self, *args, **kwargs) File "C:\Program Files (x86)\Python310\lib\site-packages\steampy\client.py", line 220, in accept_trade_offer raise ApiException("Invalid trade offer state: {} ({})".format(trade_offer_state.name, steampy.exceptions.ApiException: Invalid trade offer state: ConfirmationNeed (9)

My code:

steam_client = SteamClient(f'{API_STEAM}')
steam_client.login(f'{LOGIN_STEAM}', f'{PASSWORD_STEAM}', 'Steam/steam_guard.json')
steam_client.accept_trade_offer('6628868099')

Please help me 🙏 🙏 🙏

study657 avatar Dec 27 '23 21:12 study657

If you are submitting a proposal, use steam_client._confirm_transaction(tradeofferid)

Suxoran avatar Feb 14 '24 10:02 Suxoran

Если вы отправляете предложение, используйте steam_client._confirm_transaction(tradeofferid)

Thank you very much for trying to help, but unfortunately it did not help(( It still gives an error, although it is already different ((In general, it is very strange, because just recently the accept_trade_offer() method worked for me, but then abruptly stopped with the error that I wrote at the beginning of the message((

steam_client._confirm_transaction(trade_id)

File "C:\Program Files (x86)\Python310\lib\site-packages\steampy\client.py", line 287, in _confirm_transaction return confirmation_executor.send_trade_allow_request(trade_offer_id) File "C:\Program Files (x86)\Python310\lib\site-packages\steampy\confirmation.py", line 37, in send_trade_allow_request confirmations = self._get_confirmations() File "C:\Program Files (x86)\Python310\lib\site-packages\steampy\confirmation.py", line 60, in _get_confirmations for conf in confirmations_json['conf']: KeyError: 'conf'

My code: `steam_client = SteamClient(f'{API_KEY}') steam_client.login(login, pass, 'Steam/steam_guard.json')

trade_id = '6758267057' steam_client._confirm_transaction(trade_id)`

I take the exchanges from here: https://api.steampowered.com/IEconService/GetTradeOffers/v1/?key={API_KEY}&get_received_offers=1

study657 avatar Feb 16 '24 23:02 study657

If you are trying to confirm a RECEIVED trade, then using steam_client.accept_trade_offer(tradeofferid) was correct. Since you are using: https://api.steampowered.com/IEconService/GetTradeOffers/v1/?key={API_KEY}&get_received_offers=1

Usage steam_client._confirm_transaction(tradeofferid) follows when using: https://api.steampowered.com/IEconService/GetTradeOffers/v1/?key={API_KEY}&get_sent_offers=1

To get only active offers use active_only=1 : https://api.steampowered.com/IEconService/GetTradeOffers/v1/?key={API_KEY}&get_received_offers=1&active_only=1

To better see what the problem is, run your code this way:

steam_client = SteamClient(f"{API_KEY}")
steam_client.login(login, pass, "Steam/steam_guard.json")

trade_id = "6758267057"
try:
	steam_client.accept_trade_offer(trade_id)
except Exception as e:
	print(f"Error accept_trade_offer: {e}")

Suxoran avatar Feb 17 '24 05:02 Suxoran

Если вы пытаетесь подтвердить ПОЛУЧЕННУЮ сделку, значит, использование steam_client.accept_trade_offer(tradeofferid) было правильным. Поскольку вы используете: https://api.steampowered.com/IEconService/GetTradeOffers/v1/?key={API_KEY}&get_received_offers= 1

Использование steam_client._confirm_transaction(tradeofferid) следует при использовании: https://api.steampowered.com/IEconService/GetTradeOffers/v1/?key={API_KEY}&get_sent_offers= 1

Чтобы получать только активные предложения, используйте active_only= 1 : https://api.steampowered.com/IEconService/GetTradeOffers/v1/?key={API_KEY}&get_received_offers=1&active_only=1

Чтобы лучше понять, в чем проблема, запустите свой код следующим образом:

steam_client = SteamClient(f"{API_KEY}")
steam_client.login(login, pass, "Steam/steam_guard.json")

trade_id = "6758267057"
try:
	steam_client.accept_trade_offer(trade_id)
except Exception as e:
	print(f"Error accept_trade_offer: {e}")

Thank you so much for helping me<3 I did as you said. I took the tradeofferid from here: https://api.steampowered.com/IEconService/GetTradeOffers/v1/?key={API_KEY}&get_received_offers=1&active_only=1

However, I got an error again, this time like this:

Error accept_trade_offer: substring not found

study657 avatar Feb 17 '24 19:02 study657