Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

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.

You must be logged in to vote

Replies: 0 comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
💡
Ideas
Labels
S-needs-more-info More information is required to understand the issue
1 participant
Converted from issue

This discussion was converted from issue #530 on March 01, 2026 00:35.

Morty Proxy This is a proxified and sanitized view of the page, visit original site.