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

r.html.render() does not update cookies? Manual extracting of cookies possible? #109

Open
patarapolw opened this issue Mar 6, 2018 · 13 comments
Labels
enhancement New feature or request
Milestone

Comments

@patarapolw
Copy link

patarapolw commented Mar 6, 2018

These lines, actually

self.session = Requests(username, password).session
self.session.get('https://www.wanikani.com/dashboard').html.render()
self.session.get('https://community.wanikani.com/latest').html.render()

Which is from this project, where I simulate by disabling/enabling Javascript.

@kennethreitz
Copy link
Collaborator

not yet.

@kennethreitz kennethreitz added the enhancement New feature or request label Mar 6, 2018
@kennethreitz
Copy link
Collaborator

in the meantime, try html.render(reload=False)

@shinglyu
Copy link

So does this mean HTTP Basic Auth is not working when using render() ?

@liiight
Copy link

liiight commented Jun 6, 2018

Any update on this issue? Thanks!

@pash99
Copy link

pash99 commented Sep 9, 2018

Extraction of cookies from rendered page:

import requests_html
import asyncio

my_url = "https://example.net"

with requests_html.HTMLSession() as s:
    r = s.get(my_url)
    r.html.render(keep_page=True)
    l = asyncio.get_event_loop()
    cookies = l.run_until_complete(r.html.page.cookies())
    userAgent = l.run_until_complete(s.browser.userAgent())
    # Make sure to close the page
    l.run_until_complete(r.html.page.close())

@Exid87
Copy link

Exid87 commented May 1, 2019

Wondering if there's an update to this issue. I'm able to extract cookies and get the page I need fine.
Once I make the call to render the page, the cookies disappear and the page renders my login page instead.

@jonathanmishler
Copy link

If you install from the repo, the requests_html.HTMLResponse.html.render() function is updated to include a new parameter send_cookies_session: bool=False. I used r.html.render(send_cookies_session=True) and the webpage was no longer giving me an error about not accepting cookies.

@Franky1
Copy link

Franky1 commented Mar 10, 2020

I downloaded the latest head revision from git and installed it with pip.
I tried it with three different parameters:

  1. r.html.render(send_cookies_session=True)
  2. r.html.render(keep_page=True)
  3. r.html.render(reload=False)

None of these worked, i am always set back to the login page after calling the render() method...

@Code-Layman
Copy link

the problem remains. i use cookies to get url and then render it defaultly to get the html. but it returns only the html of login page.
r.html.render(cookies=my_cookies) or r.html.render(send_cookies_session=True) returns error. that is render() got an unexpected keyword argument.

@hotdog5225
Copy link

any solution to this problem now? resp.html.render() always without cookies.....

@agpldev
Copy link

agpldev commented Aug 23, 2023

Any update on this issue?

@Mr-DRP
Copy link

Mr-DRP commented Jan 20, 2024

Any Update ?

@bogburner
Copy link

Bump to this. send_cookies_session bool, reload=False, and including cookies in the render() call (as detailed in readthedocs) return unexpected keyword arguments or fail to render the authed page (in the case of reload).

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

No branches or pull requests