grequests
grequests copied to clipboard
Session didn't get Cookies
s := grequests.NewSession(&grequests.RequestOptions{
Headers: map[string]string{
"Host": "202.192.18.32:8080",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:51.0) Gecko/20100101 Firefox/51.0",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Accept-Language": "zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3",
"Accept-Encoding": "gzip, deflate",
"Connection": "keep-alive",
"Upgrade-Insecure-Requests": "1",
"Cache-Control": "max-age=0",
},
})
inf, err := s.Get(verifyUrl, nil)
fmt.Print(s.RequestOptions.Cookies)
fmt.Print(inf.RawResponse.Cookies())
[][JSESSIONID=3B606F518EBFD1011B57A56F8EAC8D76; Path=/selfservice]
in this case,I can't login some website and I found the Session didn't contain the Cookie. Maybe I am worry,can you tell me? thanks!
have a try, don't use session to login. send request with cookie header.
Same problem
Hi, a grequests.Session contains a RequestOptions and an HTTPClient The cookies retrieved won't be added to your RequestsOptions.Cookies but to your HTTPClient You'll find them in s.HTTPClient.Jar.entries