Open lspeed-v opened 7 months ago
For fix it, you need to make this changes https://github.com/bukson/steampy/issues/382#issuecomment-2036162567
And after change this function
def get_trade_offer(self, trade_offer_id: str, merge: bool = True, use_webtoken=False) -> dict:
params = {
'key' if not use_webtoken else 'access_token': self._api_key if not use_webtoken else self._access_token,
'tradeofferid': trade_offer_id,
'language': 'english'}
#params = {'key': self._api_key, 'tradeofferid': trade_offer_id, 'language': 'english'}
response = self.api_call('GET', 'IEconService', 'GetTradeOffer', 'v1', params).json()
if merge and 'descriptions' in response['response']:
descriptions = {get_description_key(offer): offer for offer in response['response']['descriptions']}
offer = response['response']['offer']
response['response']['offer'] = merge_items_with_descriptions_from_offer(offer, descriptions)
return response
And this function also:
def accept_trade_offer(self, trade_offer_id: str) -> dict:
trade = self.get_trade_offer(trade_offer_id, use_webtoken=True)
trade_offer_state = TradeOfferState(trade['response']['offer']['trade_offer_state'])
if trade_offer_state is not TradeOfferState.Active:
raise ApiException(f'Invalid trade offer state: {trade_offer_state.name} ({trade_offer_state.value})')
partner = self._fetch_trade_partner_id(trade_offer_id)
session_id = self._session.cookies.get_dict("steamcommunity.com")['sessionid']
accept_url = f'{SteamUrl.COMMUNITY_URL}/tradeoffer/{trade_offer_id}/accept'
params = {
'sessionid': session_id,
'tradeofferid': trade_offer_id,
'serverid': '1',
'partner': partner,
'captcha': '',
}
headers = {'Referer': self._get_trade_offer_url(trade_offer_id)}
response = self._session.post(accept_url, data=params, headers=headers).json()
if response.get('needs_mobile_confirmation', False):
return self._confirm_transaction(trade_offer_id)
return response
I changed the code the access_token part under login(), however I still face the same issue of KeyError: 'offer', the response form steam I get is {}, did you change anything else ?
I changed the code the access_token part under login(), however I still face the same issue of KeyError: 'offer', the response form steam I get is {}, did you change anything else ?
Yes, my upper comment is updated. Now it should work
Okay, I tried it and I am able to send a trade offer but I am not able to track the status of the offer, if it is accepted or not. get_trade_offer() returns empty json.
Is this project dead? Are there any alternatives?
Project is not dead. I do not actively develop it, but I still merge pull requests and maintain it. Please create a pr with desired changes that fixes things and I will gladly merge it.
When I use this method an exception occurs with text: 'offer'.