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

Question about "restler_custom_payload_header" #894

Open
pokamolodoy406 opened this issue May 26, 2024 · 1 comment
Open

Question about "restler_custom_payload_header" #894

pokamolodoy406 opened this issue May 26, 2024 · 1 comment

Comments

@pokamolodoy406
Copy link

Description

Hello!
I want to add a header to every request: "X-Auth-Token: header_value"
To do this in the file dict.json I add:

"restler_custom_payload_header": {
"X-Auth-Token": [
"header_value"
]
},

Can I specify that the header_value be the token value from the authentication script I'm using?

@tandrew-test
Copy link

You might be able to use a custom value generator for this. I have not tried it but it might work.

def get_token() -> str:
    <your auth code here>

def gen_token(**kwargs):
    while True:
        yield get_token()

value_generators = {
    'restler_custom_payload_header': {
        'X-Auth-Token': gen_token
    }
}

You would then point to the custom value generator in your engine settings file:

"custom_value_generators": "/mnt/custom_value_generators.py"

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