Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Session didn't get Cookies #50

Open
Acring opened this issue Apr 6, 2017 · 3 comments
Open

Session didn't get Cookies #50

Acring opened this issue Apr 6, 2017 · 3 comments

Comments

@Acring
Copy link

Acring commented Apr 6, 2017

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!

@ghost
Copy link

ghost commented Jul 17, 2018

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

@AurevoirXavier
Copy link

Same problem

@biblion84
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants