requests-html
requests-html copied to clipboard
render() got an unexpected keyword argument 'cookies'
ubuntu 20.04
from requests_html import HTMLSession
session = HTMLSession()
url = 'mysite.com'
r = session.get(url)
cookie=[{'name': 'value'},{'name':'value'}]
r.html.render(timeout=20, cookies = cookie)
Traceback (most recent call last): File "bot.py", line 10, in
r.html.render(cookies=cookie) TypeError: render() got an unexpected keyword argument 'cookies'
how to set a cookies for work with web site?
Same problem here
need help, hit with multiple settings like send_cookies_session , cookies and etc..
I realized the release version 0.10 is released by Sep 2019, but the latest commit is May 2020. Anyone can help to release the new version?
same issue here
same here
Same here
I solved this error with installing requests-html==0.10.0
Before there was an old version of requests-html under /usr/local/lib/python3.7/dist-packages/requests_html.py
Now cookies, send_cookies_session is available.
I solved the issue.
The latest code is not published.
You need to uninstall your current package and install the Github master branch one.
FYI, you could install this way
pip install git+https://github.com/psf/requests-html.git
I solved the issue. The latest code is not published. You need to uninstall your current package and install the Github master branch one. FYI, you could install this way
pip install git+https://github.com/psf/requests-html.git
this comment solved my problem of no "cookies" param!
but a problem produced: requests_html.MaxRetries: Unable to render the page. Try increasing timeout i have set timeout=20000, still not enough?
any one encouted this?
I solved the issue. The latest code is not published. You need to uninstall your current package and install the Github master branch one. FYI, you could install this way
pip install git+https://github.com/psf/requests-html.git
this comment solved my problem of no "cookies" param!
but a problem produced: requests_html.MaxRetries: Unable to render the page. Try increasing timeout i have set timeout=20000, still not enough?
any one encouted this?
Not sure whether this is still needed, but for future reference:
For me, this issue was caused by providing the cookies like mentioned above , but instead it wanted the dicts to be given as follows:
r.html.render(cookies=[{'name': 'cookie_name', 'value': 'cookie_value', 'domain': 'cookie_domain'}])
Note that at least one of url and domain needs to be specified.
Figured this out by printing the TypeError exception which is ignored in render() in requests_html.py on line 665 So if it doesn't fix your problem, then this exception might help you further
for i in range(retries):
if not content:
try:
content, result, page = self.session.loop.run_until_complete(...)
except TypeError as e:
print(e)
else:
break