WIP: Update to support the API changes in consulate library. Fixes #22#23
WIP: Update to support the API changes in consulate library. Fixes #22#23Imaclean74 wants to merge 3 commits intovsudilov:developfrom
Conversation
|
oh yeah - and the build will fail until we have an updated consulate package. I've pinged the maintainer to see when he will be able to push one. |
|
Hi, thanks for the keeping it up to date! This seems good to merge if/when those upstream changes are release. The only suggestion I'd make would be to keep backwards compatibility so that anyone that already uses this library doesn't have to update their code. That could be as easy as We could add a bit more complexity and print a deprecation warning for users if they access Let me know if you're up for adding that to this PR or not. Thanks! |
|
Thanks. Those changes make sense. I've added back session as a @Property - with a deprecation warning message when its referenced. |
|
|
||
| @property | ||
| def session(self): | ||
| self.app.logger.warning("session field deprecated - please use .consul") |
There was a problem hiding this comment.
I'm cool with this, and here's an alternative just in case you weren't aware: https://docs.python.org/3/library/warnings.html#warning-categories
There was a problem hiding this comment.
thanks. I did give warnings.warn a try - but the output is captured by the flask framework in the same way as print() etc. So I figured people won't actually see the warning output. Unless I'm missing something.
As described. The main change is really that much of what used to be on the Session class is now on the root Consul class in the consulate package. Also, consulate now throws its own error if the agent is unavailable or there is some other issue making a request to it.
Marking WIP - since the consulate library hasn't actually released its changes yet.