Git Product home page Git Product logo

aiosteampy's Introduction

Just common header

Stand With Ukraine Profile hits

Generic profile body.

Smart quote placeholder

Get in touch


Stand With Ukraine

aiosteampy's People

Contributors

dependabot[bot] avatar somespecialone avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

aiosteampy's Issues

'list object has no attribute items'

Initial Checks

  • I have searched the existing issues for a duplicate and I'm sure this is something new
  • I am confident that the issue in the project code

Description

If you have none listed items, Rendered listings response will return:

{'success': True, 'pagesize': 100, 'total_count': 0, 'assets': [], 'start': 0, 'num_active_listings': 0, 'listings': [], 'listings_on_hold': [], 'listings_to_confirm': [], 'buy_orders': [...]'

Where we can see that assets list is empty.

Later on in _parse_item_descriptions_for_listings method we use assets list (which is empty) and trying to call method 'items':

    def _parse_item_descriptions_for_listings(
        cls: Type["SteamCommunityMixin"],
        assets: dict[str, dict[str, dict[str, dict]]],
        item_descrs_map: dict[str, dict],
    ):
        for app_id, app_data in assets.items():
            for context_id, context_data in app_data.items():
                for a_data in context_data.values():
                    key = create_ident_code(a_data["classid"], app_id)
                    if key not in item_descrs_map:
                        item_descrs_map[key] = cls._create_item_description_kwargs(a_data, [a_data])

I just roughly looked around code and made this small fix by adding if operator (highlighted in the code). I didn't analyze how code works in deep.

    def _parse_item_descriptions_for_listings(
        cls: Type["SteamCommunityMixin"],
        assets: dict[str, dict[str, dict[str, dict]]],
        item_descrs_map: dict[str, dict],
    ):
        if assets:  # < -- BUY ADDING THIS LINE
            for app_id, app_data in assets.items():
                for context_id, context_data in app_data.items():
                    for a_data in context_data.values():
                        key = create_ident_code(a_data["classid"], app_id)
                        if key not in item_descrs_map:
                            item_descrs_map[key] = cls._create_item_description_kwargs(a_data, [a_data])

Steps To Reproduce

  1. Ensure you have no items listed
  2. Call get_my_listings method
  3. Get error "list object has no attribute items."

Environment

- Windows
- Python
- aiosteampy==0.5.4

Additional Information

No response

place_buy_order method doesn't handle steam error codes

Initial Checks

  • I have searched the existing issues for a duplicate and I'm sure this is something new
  • I am confident that the issue in the project code

Description

I was testing this library, after initial login tests I couldn't log into my account.
Default login function wasn't working for me. This was error I got:
image

Steps To Reproduce

I was using the default login function from this library. Only after I changed code to this one, I logged successfully:

    async def login(self: "SteamCommunityMixin", *, init_data=True, init_session=True):
        """
        Perform login.
        Populate `api_key`, `trade_token`, `wallet_country`, `wallet_currency` fields if it is required.

        :param init_data: fetch initial required data (api key, trade token, wallet_currency/wallet_country)
        :param init_session: init session before start auth process.
            Set this to False if you already make requests to steam from current client.
        :raises ApiError: when failed to obtain rsa key, update steam guard code
        :raises LoginError: other login process errors
        """

        # https://github.com/bukson/steampy/blob/fe0433c8cf7020318cfbbc22e79028a7576374ee/steampy/login.py#L67
        # https://github.com/DoctorMcKay/node-steam-session/blob/698469cdbad3e555dda10c81f580f1ee3960156f/examples/login-to-web-with-2fa.ts#L13
        init_session and await self.session.get(STEAM_URL.COMMUNITY)

        session_data = await self._begin_auth_session_with_credentials()
        await self._update_auth_session_with_steam_guard_code(session_data)
        await self._poll_auth_session_status(session_data)
        fin_data = await self._finalize_login()  # there can be retrieved steam id

        # https://github.com/DoctorMcKay/node-steam-session/blob/64463d7468c1c860afb80164b8c5831e629f657f/src/LoginSession.ts#L845
        transfers = [asyncio.create_task(self._perform_transfer(d, fin_data["steamID"])) for d in
                     fin_data["transfer_info"]]
        done, _ = await asyncio.wait(transfers, return_when=asyncio.FIRST_COMPLETED)

        # Transfers exception check ?

        self._set_web_cookies(done.pop().result())

        init_data and await self._init_data()

        self._is_logged = True

The only change is

        transfers = [asyncio.create_task(self._perform_transfer(d, fin_data["steamID"])) for d in
                     fin_data["transfer_info"]]

But I don't really know is it good or not

Environment

Windows
Python

Additional Information

No response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.