-
-
Notifications
You must be signed in to change notification settings - Fork 99
Capability to use the same session to generate cookies #530
Copy link
Copy link
Closed
Labels
S-needs-more-infoMore information is required to understand the issueMore information is required to understand the issue
Description
We would like to use rnet to generate cookies from a website. The issue is that we don't get all the cookies by calling the url once. Hece we need to use the same "session" to generate all the cookies.
For example:
URL: https://abc.com/xyz
Scrape call 1 to URL: Cookies = {A=B, C=D}
Scrape call 2to URL: Cookies = {E=F, G=H}
In the example above, cookies E and G get generated post the generation of cookies A and C, provided the calls are made using the same session.
We tried to use the same Client() object for both the scrape calls but we were faced with the following exception.
Due to Rust's memory management with borrowing,
you cannot use certain instances multiple times as they may be consumed.
This error can occur in the following cases:
1) You passed a non-clonable instance to a function that requires ownership.
2) You attempted to use a method that consumes ownership more than once (e.g., reading a response body twice).
3) You tried to reference an instance after it was borrowed.
Potential solutions:
1) Avoid sharing instances; create a new instance each time you use it.
2) Refrain from performing actions that consume ownership multiple times.
3) Change the order of operations to reference the instance before borrowing it.
How can we use the same session across requests in rnet? We unfortunately could not find any documentation regarding this.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
S-needs-more-infoMore information is required to understand the issueMore information is required to understand the issue