【发布时间】:2014-02-13 21:40:34
【问题描述】:
我想用 cURL 测试一些 API。我尝试按如下方式进行 GET:
curl --user username:password --request GET http://my_domain/get_result/52d6428f3ea9a008358ad2d8/
在服务器上,它显示一个“302”(这意味着重定向,对吗?)。我猜它重定向到“登录/”页面。
完成这项工作的正确方法是什么?
编辑:我试过了:
curl -c cookies.txt -b cookies.txt -L -d @login_form.txt http://my_domain/login/
其中 login_form.txt 包含“username=username&password=password&this_is_the_login_form=1”。不工作。没有生成 cookies.txt 文件。并且没有登录发生。您能告诉我您是如何使用 cURL 实现登录 Django 的吗?
【问题讨论】:
标签: django rest authentication curl