0

Using

cookies <- remDr$getAllCookies()

I am able to extract cookies from my RSelenium session.

They look something like this:

enter image description here

I can see from this answer that it is possible to manually define cookie name and values.

However, I am unsure which specific cookie is critical to my needs and so I would like to input all of these cookies into my GET request.

How can this be done programmatically? I.e., transforming the cookies "list of 33" into an input argument for the GET request?

enter image description here

In an ideal world, it would look something like this:

cookies <- remDr$getAllCookies()
get_dm_location <- GET("https://api.xxxxxx.com/apis/ui/Products/117885",
                       set_cookies(cookies))
Scott
  • 446
  • 4
  • 16

1 Answers1

0

Assuming cookies is a named list then simply call unlist() to generate the required named character vector

set_cookies(cookies %>% unlist())
QHarr
  • 83,427
  • 12
  • 54
  • 101