1

I'm trying to scrape one website, and for that, I need to exchange the cookies and headers between all the requests.

The question is the following: how can I achieve such behaviour in a smart way, not by resetting the cookies and headers manually between the Request and Response objects each time?

1 Answers1

1

You'll need a CookieJar. There's an in-memory implementation in the okhttp-urlconnection artifact.

See Automatic cookie handling with OkHttp 3 for examples

Yuri Schimke
  • 12,435
  • 3
  • 35
  • 69
Jesse Wilson
  • 39,078
  • 8
  • 121
  • 128