ODOO 8 Request.Session.Authenticate

You need to get the session id and pass it as cookie

here is the code example

parameter = {

            "db": "dbname",

            "login": "[email protected]",

            "password": "admin",    

                        }

 

headers = {'Content-type': 'application/json'}      

AUTH_URL = "http://127.0.0.1:8072/web/session/authenticate/"

data = {

        "jsonrpc": "2.0",

        "params": {

                "login": parameter['login'],

                "password": parameter['password'],

                "db": parameter['db']

            }

        }  

res = rq.post(AUTH_URL, data=json.dumps(data),headers=headers)

session_id = res.cookies["session_id"]

base_url = "127.0.0.1:8072/api/v1/modules/" # your api 

json_data = json.dumps(parameter)

json_headers = {

    "Content-Type": "application/json",

    "Accept": "application/json",

    }

'''cookies = {

    'login': "[email protected]", 

    'password': 'admin',

    'session_id':session_id

    }'''

req = rq.post("http://{}".format(base_url), data = json_data, headers=json_headers, cookies=cookies)

print(req.content) 
Obedient Osprey