Skip to content

Conversation

@Gobot1234
Copy link
Owner

@Gobot1234 Gobot1234 commented Aug 19, 2023

Summary

Add market support to the library.

Checklist

  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • This PR adds something new (e.g. new method or parameters).

TODO

@SingularBunny
Copy link
Contributor

Why not use another endpoint without the need to extract data from HTML?
For example, like this:

    async def get_listings(
            self,
            appid: int,
            market_hash_name: str,
            start: int = 0,
            count: int = 20,
            currency: int = 1,
            language: str = "english",
            response_format: str = "json"
    ) -> dict[str, Any]:
        params = {
            "start": start,
            "count": count,
            "currency": currency,
            "language": language,
            "format": response_format
        }

        params = {k: v for k, v in params.items() if v is not None}

        return await self.get(URL.COMMUNITY / f"market/listings/{appid}/{market_hash_name}/render",
                              params=params)

The code returns Json. It is much more clear.

@Gobot1234
Copy link
Owner Author

Why not use another endpoint without the need to extract data from HTML? For example, like this:

    async def get_listings(
            self,
            appid: int,
            market_hash_name: str,
            start: int = 0,
            count: int = 20,
            currency: int = 1,
            language: str = "english",
            response_format: str = "json"
    ) -> dict[str, Any]:
        params = {
            "start": start,
            "count": count,
            "currency": currency,
            "language": language,
            "format": response_format
        }

        params = {k: v for k, v in params.items() if v is not None}

        return await self.get(URL.COMMUNITY / f"market/listings/{appid}/{market_hash_name}/render",
                              params=params)

The code returns Json. It is much more clear.

Thanks! I wasn't aware of this.

@Gobot1234
Copy link
Owner Author

Oh this doesn't include the name_id, unfortunately.

@SingularBunny
Copy link
Contributor

Indeed. I could only find it in one place, and it's hardcoded there:

Market_LoadOrderSpread( 176288467 );	// initial load
--
  | PollOnUserActionAfterInterval( 'MarketOrderSpread', 5000, function() { Market_LoadOrderSpread( 176288467 ); }, 2 * 60 * 1000 );
Not looks like meaninfully provided value.

doesn't look like the value that is specifically returned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants