How to cURL an Authenticated Django App?

后端 未结 4 1338
囚心锁ツ
囚心锁ツ 2020-12-01 05:40

I\'ve a few APIs I\'d like to test with cURL. I tried doing a GET as follows:

curl --user username:password --request GET http://my_domain/get_result/52d6428         


        
4条回答
  •  無奈伤痛
    2020-12-01 06:20

    To use the token with a get request, use

    $CURL_BIN \
        -H "$DJANGO_TOKEN" \
        -X GET https://yourdjangowebsite.com/whatever/
    

    I tried using -d with -X GET, however it resulted in weird socket behaviour on the server side (Heruko H18 errors).

提交回复
热议问题