Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to save and load bhttp.session? #44

Open
mirgorodalexander opened this issue Oct 27, 2020 · 1 comment
Open

How to save and load bhttp.session? #44

mirgorodalexander opened this issue Oct 27, 2020 · 1 comment

Comments

@mirgorodalexander
Copy link

Hi guys, please can you tell me how I can save and load bhttp.session?
I mean bhttp.session() where I authorized in some web site.
Thanks!

@joepie91
Copy link
Owner

Hi, there's currently no functionality to do this directly in bhttp.

However, this sort of usecase is what the cookieJar option is meant for; you can create your own custom cookie jar using tough-cookie, have bhttp use it, and then write your own code to store the contents of that cookie jar. This will handle all cookies that bhttp has collected, and in addition to that you will need to store the 'default settings' you've configured in your bhttp.session, if any. Those two combined should allow you to fully restore a session later.

Do make sure that you're using a 2.x.x version of tough-cookie like bhttp does; I believe that versions 3 and up are not directly compatible with bhttp right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants