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.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to