Skip to content

Commit 1ddd7d6

Browse files
🚑 Fix #103: place_buy_order confirmation and response status. v0.7.18
1 parent f0d72da commit 1ddd7d6

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

aiosteampy/mixins/market.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ async def place_buy_order(
452452
price: int,
453453
quantity=1,
454454
fetch=False,
455-
confirmation_id: int | None = None,
455+
confirmation: int = 0,
456456
payload: T_PAYLOAD = {},
457457
headers: T_HEADERS = {},
458458
_item_descriptions_map: T_SHARED_DESCRIPTIONS = None,
@@ -465,7 +465,7 @@ async def place_buy_order(
465465
:param price: price of single item
466466
:param quantity: just quantity
467467
:param fetch: make request and return buy order
468-
:param confirmation_id: id of market purchase confirmation
468+
:param confirmation: id of market purchase confirmation
469469
:param payload: extra payload data
470470
:param headers: extra headers to send with request
471471
:return: buy order id or `BuyOrder`
@@ -485,24 +485,28 @@ async def place_buy_order(
485485
"market_hash_name": name,
486486
"price_total": price * quantity,
487487
"quantity": quantity,
488+
"confirmation": confirmation,
488489
**payload,
489490
}
490-
if confirmation_id is not None:
491-
data["confirmation_id"] = confirmation_id
492491

493492
headers = {"Referer": str(STEAM_URL.MARKET / f"listings/{app.value}/{name}"), **headers}
494-
r = await self.session.post(STEAM_URL.MARKET / "createbuyorder/", data=data, headers=headers)
493+
r = await self.session.post(
494+
STEAM_URL.MARKET / "createbuyorder/",
495+
data=data,
496+
headers=headers,
497+
raise_for_status=False,
498+
)
495499
rj: dict = await r.json()
496500
if rj.get("need_confirmation"):
497-
confirmation_id = int(rj["confirmation"]["confirmation_id"])
498-
await self.confirm_market_purchase(confirmation_id)
501+
confirmation = int(rj["confirmation"]["confirmation_id"])
502+
await self.confirm_market_purchase(confirmation)
499503
return await self.place_buy_order(
500504
obj,
501505
app,
502506
price=price,
503507
quantity=quantity,
504508
fetch=fetch,
505-
confirmation_id=confirmation_id,
509+
confirmation=confirmation,
506510
payload=payload,
507511
headers=headers,
508512
)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "aiosteampy"
3-
version = "0.7.17"
3+
version = "0.7.18"
44
description = "Trade and interact with steam market, webapi, guard"
55
license = "MIT"
66
authors = [{ name = "Dmytro Tkachenko", email = "itsme@somespecial.one" }]

0 commit comments

Comments
 (0)