These are chat archives for allegro/ralph

5th
Jun 2017
Mr Black
@lip177891840
Jun 05 2017 11:29
I am writing a python script taking data from ralph for Ansible invertory,it UNAUTHORIZED in ralph runserver, but works well in debug mode
    def getJsonObject(urlstr):
    url=baseURL +urlstr
    base64string = base64.encodestring('%s:%s' % (username, password)).replace('\n', '')
    request = urllib2.Request(url)
    request.add_header("Authorization", "Basic %s" % base64string) 
    result = urllib2.urlopen(request)
    data = result.read()
    # print data
    jsonObject= json.loads(data)
    # results=jsonObject['results']
    return jsonObject
Mateusz Kurek
@mkurek
Jun 05 2017 11:38
@lip177891840 are you using ralph rest api?
Mr Black
@lip177891840
Jun 05 2017 11:38
yes,
do you have any idea? i dont know the specific defferences between ralph runserver and make run
Mateusz Kurek
@mkurek
Jun 05 2017 11:47
first of all, if you are using rest api, try token authentication: http://ralph-ng.readthedocs.io/en/latest/user/api/#authentication
make run run runserver with debug enabled - that what probably makes a difference here
Mr Black
@lip177891840
Jun 05 2017 11:50
ok,i will hava a try , THANKS
Mr Black
@lip177891840
Jun 05 2017 12:06
@mkurek ,it works ,i think i need to be familiar with ralph