pythonapiclouderacloudera-manager

Error 403 from cloudera manager api in python


I want to list the configuration values of CM. So I have this code that is working on differents clusters (5.9.1, 5.10.0 and 5.8.3) :

from cm_api.api_client import ApiResource

cm_host = "XX.XX.70.12"
api = ApiResource(cm_host, username="supervision-user", password="XXXXXX" )

cm_config = api.get_cloudera_manager().get_config(view='full')

for item in cm_config:
  print("%s   =>   %s" % (item , cm_config[item]))

here are the error :

Traceback (most recent call last):
  File "./test.py", line 17, in <module>
    cm_config = api.get_cloudera_manager().get_config(view='full')
  File "build/bdist.linux-x86_64/egg/cm_api/endpoints/cms.py", line 115, in get_config
  File "build/bdist.linux-x86_64/egg/cm_api/endpoints/types.py", line 340, in _get_config

  File "build/bdist.linux-x86_64/egg/cm_api/resource.py", line 110, in get
  File "build/bdist.linux-x86_64/egg/cm_api/resource.py", line 73, in invoke
  File "build/bdist.linux-x86_64/egg/cm_api/http_client.py", line 174, in execute
cm_api.api_client.ApiException:  (error 403)

So I don't have any clue where the problem come from. What could it be ?

Thank you,

Ps : I user python cloudera API v 11.


Solution

  • I answer my own question: in fact, it come from the user right. I was not querying my different clusters with the same user. So my reading user is able to query :

    it need an admin account to be able to query everything...