[
https://issues.apache.org/jira/browse/PHOENIX-6921?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17709855#comment-17709855
]
ASF GitHub Bot commented on PHOENIX-6921:
-----------------------------------------
stoty commented on code in PR #125:
URL:
https://github.com/apache/phoenix-queryserver/pull/125#discussion_r1161086885
##########
python-phoenixdb/phoenixdb/__init__.py:
##########
@@ -56,7 +56,7 @@
def connect(url, max_retries=None, auth=None, authentication=None,
avatica_user=None, avatica_password=None,
- truststore=None, verify=None, do_as=None, user=None,
password=None, **kwargs):
+ truststore=None, verify=None, do_as=None, user=None,
password=None, headers=None, **kwargs):
Review Comment:
Better call this extra_headers.
Also, add a description for the new parameter
##########
python-phoenixdb/phoenixdb/avatica/client.py:
##########
@@ -168,7 +169,7 @@ def _post_request(self, body, headers):
if not self.session:
logger.debug("Creating a new Session")
self.session = requests.Session()
- self.session.headers.update(headers)
+ self.session.headers.update({**self.headers, **headers})
Review Comment:
We can just set the pre-merged set ofe headers here.
##########
python-phoenixdb/phoenixdb/avatica/client.py:
##########
@@ -148,6 +148,7 @@ def __init__(self, url, max_retries=None, auth=None,
verify=None):
self.max_retries = max_retries if max_retries is not None else 3
self.auth = auth
self.verify = verify
+ self.headers = headers or {}
Review Comment:
It would make more sense to merge the {'content-type':
'application/x-google-protobuf'} header and extra headers here in the
constructor, and just remove the header parameter from post_request.
We only ever use one set of headers.
> Add support for custom http headers for phoenixdb
> -------------------------------------------------
>
> Key: PHOENIX-6921
> URL: https://issues.apache.org/jira/browse/PHOENIX-6921
> Project: Phoenix
> Issue Type: New Feature
> Components: python, queryserver
> Reporter: Anton Fedotov
> Priority: Critical
>
> Phoenix Query Server sometimes can be accessed through HTTP balancer which
> uses HTTP headers to navigate the request from clients. Need to add custom
> headers support to phoenixdb.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)