Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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": "admin@gmail.com",

            "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': "admin@gmail.com", 

    'password': 'admin',

    'session_id':session_id

    }'''

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

print(req.content) 
Comment

PREVIOUS NEXT
Code Example
Python :: pandas pivot table margins percentage 
Python :: disable kivy button in kv 
Python :: copy bdc to feature class arcpy 
Python :: Fill area under line plot 
Python :: code converter html 
Python :: plotly scroll zoom 
Python :: Generate bootstrap replicate of 1D data that return a particular operation 
Python :: pypy stragger 
Python :: Connection to Python debugger failed: Interrupted function call: accept failed 
Python :: pytube.exceptions.RegexMatchError: __init__: could not find match for ^w+W 
Python :: get list values in b/w indexes python 
Python :: create layer file arcpy 
Python :: linke dlists in python 
Python :: Normalize basic list data 
Python :: convert matlab code to python 
Python :: how to count the repeatance of every string in a list python 
Python :: pd.generate_date 
Python :: delta lake with spark 
Python :: ERROR: Target path exists but is not a directory, will not continue. 
Python :: python matrices access column 
Python :: windows py SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate 
Python :: python dummy command 
Python :: poision in chinese 
Python :: rebuild database from zero django postgres 
Python :: python iterar claves 
Python :: how to select name parent table in model laravel 
Python :: raspberry pi run a python script using ssh 
Python :: does building wheel for dlib setup py takes forever 
Python :: pass in 2 numbers, A and B. You should create a list with A rows and B columns, then populate each cell 
Python :: in python how to end the code after 10 input 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =