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

Does Unleash Client Python supports Dynamic headers? #104

Closed
ryanermita opened this issue Jul 21, 2020 · 3 comments
Closed

Does Unleash Client Python supports Dynamic headers? #104

ryanermita opened this issue Jul 21, 2020 · 3 comments
Labels

Comments

@ryanermita
Copy link

I got the same problem with Support for setting headers dynamically from unleash-client-node but mine is for Python.

I saw that dynamic headers are already supported in unleash-client-node and unleash-client-java.
I was wondering if there's an implementation of this feature in unleash-client-python.

If none, what is your recommended work around?

Thank you!

@ivanklee86
Copy link
Collaborator

Good morning!

Modifying the unleash_custom_headers class variable (a plain old dictionary) on the client will update the request headers the next time the client sends an API request to the server.

Something like the following should work:

my_client.unleash_custom_headers['Authorization'] = "MyNewAuthorizationCode"

Having said that, I've mainly done this using integration scripts for testing purposes. Could you let me know how it works for you? (If it works great, I'll add it to the documentation.)

@ryanermita
Copy link
Author

Hi @ivanklee86,
I test your scenario, unleash_custom_headers are being updated but the workers still using the headers from the client initialization. I validated it by logging the headers on my unleash client and on my python test script using the unleash-client-python

I tried to re-initialize the client using client.initialize_client() after changing the headers in the assumption that it would also re-initialize the workers but it raises this error:

    raise SchedulerAlreadyRunningError
apscheduler.schedulers.SchedulerAlreadyRunningError: Scheduler is already running

@stale
Copy link

stale bot commented Jul 5, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jul 5, 2022
@stale stale bot closed this as completed Jul 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants