Skip to content

Item cannot be resolved for sell listings of Strange items #8

Description

@StrangePlay02

In the documentation https://api.backpack.tf/api/index.html#/classifieds/post_v2_classifieds_listings_batch,

Models > listingResolvable specifies that if id is set, listing is assumed to be sell and if item is set, it is assumed to be a buy:

Image

The code currently sets item for both intents (and specify id only when selling), and may lead to conflicts in resolving the item if both inputs are sent.

def construct_listing(
    sku: str, intent: str, currencies: dict, details: str, asset_id: int = 0
) -> dict:
    if intent not in ["buy", "sell"]:
        raise InvalidIntent(f"{intent} must be buy or sell")

    listing = {
        "item": construct_listing_item(sku),
        "buyout": True,
        "offers": True,
        "promoted": False,
        "details": details,
        "currencies": Currencies(**currencies).__dict__,
    }

    if intent == "sell":
        listing["id"] = asset_id

    return listing

I think we may need to consider setting listing["item"] only for buy listings. While it only happens for Strange items, I also do not consistently face it and has succeeded few times. Strange indeed

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions