How to get custom header in django restframework

1,872 views
Skip to first unread message

anil yadav

unread,
Jul 8, 2019, 3:03:57 AM7/8/19
to Django REST framework
Hello,

import requests
I am not able to get custom header from API side

url = "http://127.0.0.1:9090/api/router/"

headers = {
'HTTP_MY': "qw",

'postman-token': "baa2316e-8058-321f-4fd2-920272903e21"
}

response = requests.request("POST", url, headers=headers)



Chetan Ganji

unread,
Jul 8, 2019, 9:02:52 AM7/8/19
to django-res...@googlegroups.com
Read request response object of django n drf. They bother are different. 

Use dir() on request object of drf and see which variable is available for headers.

--
You received this message because you are subscribed to the Google Groups "Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-fram...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-rest-framework/85a36d30-221f-4d69-a675-645e01e2c21b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages