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

Set session variables inside a plugin #318

Open
shivakharbanda opened this issue Apr 24, 2024 · 2 comments
Open

Set session variables inside a plugin #318

shivakharbanda opened this issue Apr 24, 2024 · 2 comments

Comments

@shivakharbanda
Copy link

I would like to set session variables inside plugin so i can use those variables inside other plugin. Is there a way to do it?

@liqul
Copy link
Contributor

liqul commented Apr 25, 2024

I haven't tried this, but I think it is doable as all the executions in the same session share the same context. But I think you need to modify the code in context.py. You can find the following code there

    def get_session_var(
        self,
        variable_name: str,
        default: Optional[str] = None,
    ) -> Optional[str]:
        if variable_name in self.executor.session_var:
            return self.executor.session_var[variable_name]
        return default

What you need is to implement another function set_session_var accordingly.

@shivakharbanda
Copy link
Author

Okay thank you. I’ll try to implement this

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

2 participants