How to use cURL to send Cookies?

前端 未结 5 1828
孤独总比滥情好
孤独总比滥情好 2020-11-30 17:09

I read that Send cookies with curl works, but not for me.

I have a REST endpoint as:

class LoginResource(restful.Resource):
    def get(         


        
5条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-30 17:17

    I'm using Debian, and I was unable to use tilde for the path. Originally I was using

    curl -c "~/cookie" http://localhost:5000/login -d username=myname password=mypassword
    

    I had to change this to:

    curl -c "/tmp/cookie" http://localhost:5000/login -d username=myname password=mypassword
    

    -c creates the cookie, -b uses the cookie

    so then I'd use for instance:

    curl -b "/tmp/cookie" http://localhost:5000/getData
    

提交回复
热议问题