Issue
Im doing this curl request to get some data in python , how can i get session id of curl request so that i can reuse again.
commands.getoutput("curl -H \"Content-Type:application/json\" -k -u username:password -X GET https://10.39.11.4/wapi/v2.7/member -s"
Solution
curl has a built-in cookie jar meant for storing just the cookies and sending them back to the server.
To store cookies in the cookie jar we use the -c flag and give it the name of a file we wish to store the cookies in.
$ curl -X POST -c cookies.txt -u "user1:password1" website.com/login
$ cat cookies.txt
# Netscape HTTP Cookie File
# http://curl.haxx.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.
#HttpOnly_quiet-waters-1228.herokuapp.com FALSE / FALSE 0 _curl_test_app_rails_
session cm53d2RJN1VncV........
There you can find session ID .
As Mentioned by Daniel Stenberg (founder of cURL):
use -b cookies.txt in the subsequent curl command line to make use of those cookies
Answered By - NoorJafri Answer Checked By - Robin (WPSolving Admin)