0

I am running a curl command on Windows 7, which I got from 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

... but I get the error:

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.

I tried the same command but with single quotes but this yields the same error.

3
  • 1
    Are the quotes the same as you typed them? They're not the normal straight quotes ("), and a shell won't recognize them. Commented Jun 25, 2015 at 16:38
  • Yes the quotes are the same as I typed them. I tried using the sloping quote character ` instead, but I got the same error. Commented Jun 25, 2015 at 16:55
  • Right, I see what you (ivan_pozdeev) are saying. The quotes from the web page are curly quotes and they need to be straight quotes. Commented Jun 25, 2015 at 18:02

1 Answer 1

2

this is interpretted as several commands

  1. curl -X POST -d

  2. “client_id=W2fzDmkbyK3bKBALafspe84RqIGHUpeuRlpn8uTt&

  3. client_secret=lmrtAQn1oHnaLBUYAVef1w0S3BoaLVbCaLpAmXbjBh8o94k13i9kh6eo

  4. Qz0johA8RxsBwaG5H2R7q2NON3KtcB0lvuGbE4lM6w9BlQQP5ycuFlXAOUJ7CfUMmBcnyKol&

  5. grant_type=password&username=daniel&password=daniel”

  6. http://localhost:8000/auth/token

each of these is clearly an error corresponding to each error message above

so change your command to

curl -X POST -d "client_id=W2fzDmkbyK3bKBALafspe84RqIGHUpeuRlpn8uTt&client_secret=lmrtAQn1oHnaLBUYAVef1w0S3BoaLVbCaLpAmXbjBh8o94k13i9kh6eoQz0johA8RxsBwaG5H2R7q2NON3KtcB0lvuGbE4lM6w9BlQQP5ycuFlXAOUJ7CfUMmBcnyKol&grant_type=password&username=daniel&password=daniel" http://localhost:8000/auth/token

Alternatively, add ^ at the end of incomplete lines for cmd to interpret them as a single line.

Sign up to request clarification or add additional context in comments.

4 Comments

Oh, I forgot to say that I split the command just so that it would look good on here. When I entered the command in the command prompt I made sure it did not have any carriage returns / line feeds.
well if you copy my example exactly it should work(ie copy/paste) ... (I tested it and it worked for me at least(well other than not having a localhost server running) ... however since windows does not actually come with curl I cannot be sure we are using the same curl command
You're right, it worked. I think my problem was that I was copying the command from Notepad.
I found that I can prepare the command in Notepad, but it is easier if "word wrap" is disabled.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.