-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
create_buy_order not working #6
Comments
Hi! I had this error too! As I understood here the problem is in quantity=buy_quantity, values greater than 2 give an error. |
When 1 also error. But everything is fine with the old device and ip, this error is only when logging into the account, either from the new ip, or the device, or together I have already tested it a little, most likely the problem is that not all cookies are received when logging in. As soon as I have time, I'll take it up. |
I have fixed my error. The problem was that I was sending an invalid floating point value to the function. Although then it is strange why it worked with values 1,2... |
I tried to correct this error in Steampy def create_buy_order(
self,
market_name: str,
price_single_item: str,
quantity: int,
game: GameOptions,
currency: Currency = Currency.USD,
) -> dict:
data = {
'sessionid': self._session.cookies.get_dict("steamcommunity.com")['sessionid'], #<<-------------------
'currency': currency.value,
'appid': game.app_id,
'market_hash_name': market_name,
'price_total': str(Decimal(price_single_item) * Decimal(quantity)),
'quantity': quantity,
}
headers = {
'Referer': f'{SteamUrl.COMMUNITY_URL}/market/listings/{game.app_id}/{urllib.parse.quote(market_name)}'
}
response = self._session.post(f'{SteamUrl.COMMUNITY_URL}/market/createbuyorder/', data, headers=headers).json()
return response def set_sessionid_cookies(self):
community_domain = SteamUrl.COMMUNITY_URL[8:]
store_domain = SteamUrl.STORE_URL[8:]
community_cookie_dic = self.session.cookies.get_dict(domain=community_domain)
store_cookie_dic = self.session.cookies.get_dict(domain=store_domain)
for name in ('steamLoginSecure', 'sessionid', 'steamRefresh_steam', 'steamCountry'):
cookie = self.session.cookies.get_dict()[name]
if name in ["steamLoginSecure"]:
store_cookie = create_cookie(name, store_cookie_dic[name], store_domain)
else:
store_cookie = create_cookie(name, cookie, store_domain)
if name in ["sessionid", "steamLoginSecure"]:
community_cookie = create_cookie(name, community_cookie_dic[name], community_domain)
else:
community_cookie = create_cookie(name, cookie, community_domain)
self.session.cookies.set(**community_cookie)
self.session.cookies.set(**store_cookie) |
File "F:\BUFF\Buy_Bot\test.py", line 31, in main
market = steam_client.market.create_buy_order(app_id='730', market_hash_name=market_hash_name, price_single_item=buy_price, quantity=buy_quantity)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "F:\BUFF\Buy_Bot\venv\Lib\site-packages\steamcom\utils.py", line 21, in func_wrapper
return func(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "F:\BUFF\Buy_Bot\venv\Lib\site-packages\steamcom\market.py", line 126, in create_buy_order
response = api_request(self.session, url, headers=headers, data=data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "F:\BUFF\Buy_Bot\venv\Lib\site-packages\steamcom\utils.py", line 276, in api_request
raise ApiException(f'HTTP status code: {response.status_code}')
steamcom.exceptions.ApiException: HTTP status code: 400
/
The text was updated successfully, but these errors were encountered: