我在Windows 7上运行curl命令,我从https://pypi.python.org/pypi/django-rest-framework-social-oauth2/0.0.4获得了
curl -X POST -d
“client_id=W2fzDmkbyK3bKBALafspe84RqIGHUpeuRlpn8uTt&
client_secret=lmrtAQn1oHnaLBUYAVef1w0S3BoaLVbCaLpAmXbjBh8o94k13i9kh6eo
Qz0johA8RxsBwaG5H2R7q2NON3KtcB0lvuGbE4lM6w9BlQQP5ycuFlXAOUJ7CfUMmBcnyKol&
grant_type=password&username=daniel&password=daniel”
http://localhost:8000/auth/token
...但我收到错误:
curl: no URL specified!
curl: try 'curl --help' or 'curl --manual' for more information
'client_secret' is not recognized as an internal or external command,
operable program or batch file.
'grant_type' is not recognized as an internal or external command,
operable program or batch file.
'username' is not recognized as an internal or external command,
operable program or batch file.
'password' is not recognized as an internal or external command,
operable program or batch file.
我尝试了相同的命令,但使用单引号,但这会产生相同的错误。
答案 0 :(得分:1)
这被解释为几个命令
curl -X POST -d
“client_id=W2fzDmkbyK3bKBALafspe84RqIGHUpeuRlpn8uTt&
client_secret=lmrtAQn1oHnaLBUYAVef1w0S3BoaLVbCaLpAmXbjBh8o94k13i9kh6eo
Qz0johA8RxsBwaG5H2R7q2NON3KtcB0lvuGbE4lM6w9BlQQP5ycuFlXAOUJ7CfUMmBcnyKol&
grant_type=password&username=daniel&password=daniel”
http://localhost:8000/auth/token
这些中的每一个显然都是与上面的每条错误消息相对应的错误
所以将命令更改为
curl -X POST -d "client_id=W2fzDmkbyK3bKBALafspe84RqIGHUpeuRlpn8uTt&client_secret=lmrtAQn1oHnaLBUYAVef1w0S3BoaLVbCaLpAmXbjBh8o94k13i9kh6eoQz0johA8RxsBwaG5H2R7q2NON3KtcB0lvuGbE4lM6w9BlQQP5ycuFlXAOUJ7CfUMmBcnyKol&grant_type=password&username=daniel&password=daniel" http://localhost:8000/auth/token
或者,cmd
add ^
at the end of incomplete lines将其解释为单行。