Uh oh!
There was an error while loading. Please reload this page.
Add custom session injection, Fix bug for http_options - #1119
Conversation
* ssl-verify is an option, not a header
* Allow injection of session_factory to allow use of a custom session
t8y8
left a comment
There was a problem hiding this comment.
I'm not sure I love the session factory approach to be honest. It feels like a pretty advanced use case. We also aren't sure that the http_options interface we have is going to work with or apply to every possible session type .
If we really do want support that case. I think it's slightly safer/more-robust if we:
- Make
session_factorya kw-only argument, and make the defaultNone. - Then in the
__init__method if factory is None use requests.session
I think that makes it less likely to accidentally set it, and protect against an oopsie in changing the signature in the future
Regardless, for the http_options bit, left a few comments
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| CreateNew = "CreateNew" | ||
| def __init__(self, server_address, use_server_version=False, http_options=None): | ||
| def __init__(self, server_address, use_server_version=False, http_options=None, session_factory=requests.Session): |
There was a problem hiding this comment.
| def__init__(self, server_address, use_server_version=False, http_options=None, session_factory=requests.Session): | |
| def__init__(self, server_address, use_server_version=False, http_options=None, *, session_factory=None): | |
| ifsession_factoryisNone: | |
| self._session=requests.Session() | |
| else: | |
| self._session=session_factory() |
Pylint with "errors only" isn't 100% accurate, but it found a few problems that should be fixed.
* ssl-verify is an option, not a header * Allow injection of session_factory to allow use of a custom session * show server info (tableau#1118) * Fix bug in exposing ExcelRequestOptions and test (tableau#1123) * Fix a few pylint errors (tableau#1124) Co-authored-by: Marwan Baghdad <mrwanbaghdad76@gmail.com> Co-authored-by: jorwoods <jorwoods@users.noreply.github.com> Co-authored-by: Brian Cantoni <bcantoni@salesforce.com>
No description provided.