grequests icon indicating copy to clipboard operation
grequests copied to clipboard

Session didn't get Cookies

Open Acring opened this issue 7 years ago • 3 comments

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!

Acring avatar Apr 06 '17 06:04 Acring

have a try, don't use session to login. send request with cookie header.

ghost avatar Jul 17 '18 20:07 ghost

Same problem

AurevoirXavier avatar May 15 '19 20:05 AurevoirXavier

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

biblion84 avatar Jul 29 '20 09:07 biblion84