8000 request_params not initialized when using serialized token · Issue #36 · safepost/aiobastion · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
request_params not initialized when using serialized token #36
Open
@dot-mike

Description

@dot-mike

Hi and thank you for this awesome library.

I tried using today where I save the token received for future use and when I try to re-use the token I get this error where request_params is None type.

When I login with yaml file (no otken token data stored) I can see that request_params is set to {'timeout': 45, 'ssl': <ssl.SSLContext object at 0x7ff889183ad0>} but None if try to login with existing token

basically this is my code below.

async def _initialize_vault(self) -> EPV:
        """Initialize vault with existing token or new connection."""
        token_data = self.token_manager.get_token()

        if token_data:
            logger.debug("Reusing existing CyberArk token for vault")
            vault = EPV(serialized=token_data)
            # adding the below call resolves the issue
            # vault.validate_and_setup_ssl()
            print(vault)
        else:
            logger.debug("Trying to login to CyberArk vault")
            vault = EPV(self.config_path)

        async with vault:
            user_info = await vault.user.get_logged_on_user_details()
            logger.debug(f"CyberArk logged in as {user_info['UserName']}")
            json_epv = vault.to_json()
            self.token_manager.save_token(json_epv)

            await vault.close_session()

        self.vault = vault
        return vault
  File "/home/dot-mike/.pyenv/versions/3.13.1/envs/api/lib/python3.13/site-packages/aiobastion/cyberark.py", line 282, in __aenter__
    await self.login()
  File "/home/dot-mike/.pyenv/versions/3.13.1/envs/api/lib/python3.13/site-packages/aiobastion/cyberark.py", line 547, in login
    if await self.check_token():
       ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dot-mike/.pyenv/versions/3.13.1/envs/api/lib/python3.13/site-packages/aiobastion/cyberark.py", line 351, in check_token
    await self.handle_request("get", "api/LoginsInfo")
  File "/home/dot-mike/.pyenv/versions/3.13.1/envs/api/lib/python3.13/site-packages/aiobastion/cyberark.py", line 760, in handle_request
    async with session.request(method, url, json=data, headers=head, params=params,
               ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                               **self.request_params) as req:
                               ^^^^^^^^^^^^^^^^^^^^^^
TypeError: aiohttp.client.ClientSession.request() argument after ** must be a mapping, not NoneType

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0