3

I am trying to pass cookies from a headless browser in golang to the requests package cookiejar. There are some JS generated cookies that I need to grab using the headless broswer and then pass to the requests module.

I currently have this to export the headless browser cookies to a JSON file, but I am not sure how to dynamically add them to the cookie jar for continuing the task with the requests module.

    func transferCookies() {
        Cookies := (browser.MustGetCookies())
        data, _ := json.Marshal(Cookies)

the data variable returns cookies in the following format:

{"name":"name","value":"value","domain":"domain","path":"path","expires":expires,"size":size,"httpOnly":bool,"secure":bool,"session":bool,"priority":"priority","sameParty":bool,"sourceScheme":"Secure","sourcePort":port}     
eglease
  • 2,445
  • 11
  • 18
  • 28
AntBox
  • 31
  • 1

0 Answers0