Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for market interactions #305

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from
Draft

Add support for market interactions #305

wants to merge 13 commits into from

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.

2 participants