Erp next api post request, error 500

I am trying to create a new project on ERP using the API. The code is as follows

if user is not None and passd is not None:
			params = {'usr':user, 'pwd':passd}

			session = Session()
			auth = session.get('', params=params)

			args = {}
			if auth.status_code == 200:
				project = session.request('GET', '[["Project", "user", "=", "%s"]]' %user).json()
				company = session.request('GET', '[["Company","Email","=","%s"]]' %user).json()
				comp_name = company['data'][0]['name']
				warehouse = session.request('GET', '[["Warehouse", "Company", "=", "%s"]]' %comp_name).json() 

                            #POST REQUEST FAILS
				data = json.dumps({'name':'Paul Store'})
				sess_post ='', data="data="+data, headers={'Content-type':'application/json'})

				print dir(sess_post)
				print sess_post.reason
				print sess_post.cookies


				args['project'] = project
				args['warehouse'] = warehouse

				return render(request, 'index.html' , args)

the point of issue is the POST Request that is failing, please help thanks

I think you also need to append the session id in the headers for authentication

In all your post examples they don’t have authentication headers as a guideline

Check your bench logs for any errors

for future reference

from this github repo there is script it will enable you to interact with the doctypes via API just follow the example from github