You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by ma...@apache.org on 2023/02/11 07:02:11 UTC
[ranger] branch ranger-2.4 updated (8d4729983 -> 4aaa1b11b)
This is an automated email from the ASF dual-hosted git repository.
madhan pushed a change to branch ranger-2.4
in repository https://gitbox.apache.org/repos/asf/ranger.git
from 8d4729983 RANGER-3991 : Upgrade underscore-min.js, underscore.js and moment-with-locales.min.js
new e5389eba1 RANGER-4064: Fix python client usage on SSL enabled cluster w/o host verification
new 4aaa1b11b RANGER-4079: Python client fix to handle URLs having subpaths
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../python/apache_ranger/client/ranger_client.py | 26 +++++++++++++++++-----
1 file changed, 21 insertions(+), 5 deletions(-)
[ranger] 02/02: RANGER-4079: Python client fix to handle URLs having subpaths
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
madhan pushed a commit to branch ranger-2.4
in repository https://gitbox.apache.org/repos/asf/ranger.git
commit 4aaa1b11be3e88d69147ce947c63fb58834e0dd1
Author: Madhan Neethiraj <ma...@apache.org>
AuthorDate: Fri Feb 10 14:05:44 2023 -0800
RANGER-4079: Python client fix to handle URLs having subpaths
(cherry picked from commit 63cf6007fb5c25a8b4558ad8b0ce31322e19d853)
---
.../python/apache_ranger/client/ranger_client.py | 24 ++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)
diff --git a/intg/src/main/python/apache_ranger/client/ranger_client.py b/intg/src/main/python/apache_ranger/client/ranger_client.py
index e26528013..260095b2f 100644
--- a/intg/src/main/python/apache_ranger/client/ranger_client.py
+++ b/intg/src/main/python/apache_ranger/client/ranger_client.py
@@ -40,8 +40,8 @@ QUERY_PARAM_USER_DOT_NAME = 'user.name'.encode("utf-8")
class RangerClient:
- def __init__(self, url, auth):
- self.client_http = RangerClientHttp(url, auth)
+ def __init__(self, url, auth, query_params=None, headers=None):
+ self.client_http = RangerClientHttp(url, auth, query_params, headers)
self.session = self.client_http.session
logging.getLogger("requests").setLevel(logging.WARNING)
@@ -433,8 +433,10 @@ class RESTResponse(RangerBase):
class RangerClientHttp:
- def __init__(self, url, auth):
- self.url = url.rstrip('/')
+ def __init__(self, url, auth, query_params=None, headers=None):
+ self.url = url.rstrip('/') + '/' # ensure that self.url ends with a /
+ self.query_params = query_params
+ self.headers = headers
self.session = Session()
self.session.auth = auth
@@ -443,6 +445,20 @@ class RangerClientHttp:
ret = None
params = { 'headers': { 'Accept': api.consumes, 'Content-type': api.produces } }
+ if self.headers:
+ params['headers'].update(self.headers)
+
+ if self.query_params:
+ if query_params:
+ merged_query_params = {}
+
+ merged_query_params.update(self.query_params)
+ merged_query_params.update(query_params)
+
+ query_params = merged_query_params
+ else:
+ query_params = self.query_params
+
if query_params:
params['params'] = query_params
[ranger] 01/02: RANGER-4064: Fix python client usage on SSL enabled cluster w/o host verification
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
madhan pushed a commit to branch ranger-2.4
in repository https://gitbox.apache.org/repos/asf/ranger.git
commit e5389eba12fe9c1bd71a8a29e49c6297e4a06dc0
Author: Abhishek Kumar <ab...@apache.org>
AuthorDate: Thu Feb 2 14:50:50 2023 -0800
RANGER-4064: Fix python client usage on SSL enabled cluster w/o host verification
(cherry picked from commit c86c62fde0dde2c06fb6ce7d09a8e374ce72012b)
---
intg/src/main/python/apache_ranger/client/ranger_client.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/intg/src/main/python/apache_ranger/client/ranger_client.py b/intg/src/main/python/apache_ranger/client/ranger_client.py
index f3e9bfe25..e26528013 100644
--- a/intg/src/main/python/apache_ranger/client/ranger_client.py
+++ b/intg/src/main/python/apache_ranger/client/ranger_client.py
@@ -42,7 +42,7 @@ QUERY_PARAM_USER_DOT_NAME = 'user.name'.encode("utf-8")
class RangerClient:
def __init__(self, url, auth):
self.client_http = RangerClientHttp(url, auth)
-
+ self.session = self.client_http.session
logging.getLogger("requests").setLevel(logging.WARNING)