python - passing a cookie as header using request.COOKIES.get('cfrtoken') not working -


i have application needs cookie information passed headers. when passing using

 childrequest.add_header('cookie','cfrtoken=blahblah') 

it's working expected.

but when try same cookie information dynamically failing.

childrequest.add_header('cookie','cfrtoken= +  request.cookies.get('cfrtoken')) 

i'ts failing. not sure whats issue.

i checked request.cookies.get('cfrtoken') giving valid cookie.

you're missing ' in childrequest.add_header('cookie','cfrtoken= + request.cookies.get('cfrtoken'))

should :

childrequest.add_header('cookie','cfrtoken=' + request.cookies.get('cfrtoken'))