-
Notifications
You must be signed in to change notification settings - Fork 30
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
requires_credentials
circumvents any overriden credentials store
#10
Comments
Thanks for opening an issue - you're right that a long-running webservice isn't a well-supported use case right now. Your idea looks good - off the top of my head, you could then create your own implementation of a |
Following the negative feedback on PR 61, I've created a new PR #68 which keeps the decorator and is similar to the pseudo-code from @sbv-trueenergy. |
I think this can be closed now, it's available in release v0.6.0 |
Seeing as the
Gigya
andKamareon
classes can be initialized with acredentials
variable it seems like the@requires_credentials
decorator would still use the singletonCredentialsStore()
to verify that right api-keys are available.https://github.com/jamesremuscat/pyze/blob/develop/src/pyze/api/credentials.py#L19
https://github.com/jamesremuscat/pyze/blob/develop/src/pyze/api/kamereon.py#L41
We are considering using this library in a webservice but the hard dependency on a single car/login in a file-on-disk makes that a bit cumbersome when running multiple flask processes on the same machine.
Currently we would scratch the file on each request and write a new file with json in it that matches the given request - to switch between tokens/users/cars. But if multiple requests are being handled at once the file would be overriden/inconsistent if it were to happen on a single machine/container.
I don't have a straightforward idea for a fix but perhaps it could be decorator from
self._credentials
instead of a global one?. Or a something similar to my psedocode decorator here:or something more radical where the api code won't use the decorator and let the api consumers deal with the missing keys.
The text was updated successfully, but these errors were encountered: