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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and 95C1 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

Open
dot-mike opened this issue Jan 29, 2025 · 0 comments
Open

request_params not initialized when using serialized token #36

dot-mike opened this issue Jan 29, 2025 · 0 comments

Comments

@dot-mike
Copy link
dot-mike commented Jan 29, 2025

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
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

No branches or pull requests

1 participant
0