Uploaded image for project: 'Ranger'
  1. Ranger
  2. RANGER-3668

JSONDecodeError

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.2.0
    • 2.2.0
    • Ranger
    • ranger is hosted on azure k8s service, im trying to connect to it using apache-ranger python library
    • Important

    Description

      from trino.dbapi import connect
      from trino.auth import BasicAuthentication
      from apache_ranger.model.ranger_service import *
      from apache_ranger.client.ranger_client import *
      from apache_ranger.model.ranger_policy  import * 
      ranger_url  = "http://dummy_host:0000"
      ranger_auth = ("dummy_user", "dummy_pass") 
      ranger = RangerClient(ranger_url, ranger_auth) 
      
      for role in ranger.find_roles():    
         print(str(role.id)) 

      when i try to run the above code i get the below error

      Traceback (most recent call last):
        File "c:\Users\j.shimoga.prakash\Desktop\pls work - Copy\test.py", line 17, in <module>
          for role in ranger.find_roles():
        File "C:\Users\j.shimoga.prakash\Desktop\pls work - Copy\venv\lib\site-packages\apache_ranger\client\ranger_client.py", line 254, in find_roles
          resp = self.__call_api(RangerClient.FIND_ROLES, filter)
        File "C:\Users\j.shimoga.prakash\Desktop\pls work - Copy\venv\lib\site-packages\apache_ranger\client\ranger_client.py", line 334, in __call_api
          raise RangerServiceException(api, response)
        File "C:\Users\j.shimoga.prakash\Desktop\pls work - Copy\venv\lib\site-packages\apache_ranger\exceptions.py", line 39, in __init__
          respJson = response.json()
        File "C:\Users\j.shimoga.prakash\Desktop\pls work - Copy\venv\lib\site-packages\requests\models.py", line 910, in json
          return complexjson.loads(self.text, **kwargs)
        File "C:\Users\j.shimoga.prakash\Desktop\pls work - Copy\venv\lib\site-packages\simplejson\__init__.py", line 525, in loads
          return _default_decoder.decode(s)
        File "C:\Users\j.shimoga.prakash\Desktop\pls work - Copy\venv\lib\site-packages\simplejson\decoder.py", line 370, in decode
          obj, end = self.raw_decode(s)
        File "C:\Users\j.shimoga.prakash\Desktop\pls work - Copy\venv\lib\site-packages\simplejson\decoder.py", line 400, in raw_decode
          return self.scan_once(s, idx=_w(s, idx).end())
      simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0) 

      also worth noting, giving in-correct user or pass does not change the error received but changing the host or port does give a diff error (max retries exceeded)

      Attachments

        Activity

          People

            rmani Ramesh Mani
            Jeevan_sp Jeevan p
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: