Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python请求\u html:给我超时错误_Python_Python 3.x_Web Scraping_Python Requests_Python Requests Html - Fatal编程技术网

Python请求\u html:给我超时错误

Python请求\u html:给我超时错误,python,python-3.x,web-scraping,python-requests,python-requests-html,Python,Python 3.x,Web Scraping,Python Requests,Python Requests Html,我正试图通过使用名为requests\uhtml 我使用的代码在别人的电脑上运行良好,但在我的电脑上运行不好 原始代码如下所示: from requests_html import HTMLSession session = HTMLSession() r = session.get('https://medium.com/@daranept27') r.html.render() x = r.html.find('a.eg.bv') [print(elem.text) for elem i

我正试图通过使用名为
requests\uhtml

我使用的代码在别人的电脑上运行良好,但在我的电脑上运行不好

原始代码如下所示:

from requests_html import HTMLSession

session = HTMLSession()
r = session.get('https://medium.com/@daranept27')
r.html.render()

x = r.html.find('a.eg.bv')
[print(elem.text) for elem in x]
Traceback (most recent call last):

  File "C:\Users\intel\Desktop\hackerrank.py", line 5, in <module>
    r.html.render()
  File "C:\Users\intel\AppData\Local\Programs\Python\Python38\lib\site-packages\requests_html.py", line 598, in render
    content, result, page = self.session.loop.run_until_complete(self._async_render(url=self.url, script=script, sleep=sleep, wait=wait, content=self.html, reload=reload, scrolldown=scrolldown, timeout=timeout, keep_page=keep_page))
  File "C:\Users\intel\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py", line 616, in run_until_complete
    return future.result()
  File "C:\Users\intel\AppData\Local\Programs\Python\Python38\lib\site-packages\requests_html.py", line 512, in _async_render
    await page.goto(url, options={'timeout': int(timeout * 1000)})
  File "C:\Users\intel\AppData\Local\Programs\Python\Python38\lib\site-packages\pyppeteer\page.py", line 885, in goto

    raise error
pyppeteer.errors.TimeoutError: Navigation Timeout Exceeded: 8000 ms exceeded.

[Finished in 13.0s with exit code 1]

[shell_cmd: python -u "C:\Users\intel\Desktop\hackerrank.py"]
[dir: C:\Users\intel\Desktop]
[path: C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\nodejs\;C:\Python38;C:\Users\intel\AppData\Local\Programs\Python\Python38\Scripts\;C:\Users\intel\AppData\Local\Programs\Python\Python38\;C:\MinGW\bin;C:\Users\intel\AppData\Local\Programs\Microsoft VS Code\bin]
它给我提供了
pyppeteer.errors.TimeoutError:超过导航超时:超过8000毫秒。

以下是全部错误:

from requests_html import HTMLSession

session = HTMLSession()
r = session.get('https://medium.com/@daranept27')
r.html.render()

x = r.html.find('a.eg.bv')
[print(elem.text) for elem in x]
Traceback (most recent call last):

  File "C:\Users\intel\Desktop\hackerrank.py", line 5, in <module>
    r.html.render()
  File "C:\Users\intel\AppData\Local\Programs\Python\Python38\lib\site-packages\requests_html.py", line 598, in render
    content, result, page = self.session.loop.run_until_complete(self._async_render(url=self.url, script=script, sleep=sleep, wait=wait, content=self.html, reload=reload, scrolldown=scrolldown, timeout=timeout, keep_page=keep_page))
  File "C:\Users\intel\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py", line 616, in run_until_complete
    return future.result()
  File "C:\Users\intel\AppData\Local\Programs\Python\Python38\lib\site-packages\requests_html.py", line 512, in _async_render
    await page.goto(url, options={'timeout': int(timeout * 1000)})
  File "C:\Users\intel\AppData\Local\Programs\Python\Python38\lib\site-packages\pyppeteer\page.py", line 885, in goto

    raise error
pyppeteer.errors.TimeoutError: Navigation Timeout Exceeded: 8000 ms exceeded.

[Finished in 13.0s with exit code 1]

[shell_cmd: python -u "C:\Users\intel\Desktop\hackerrank.py"]
[dir: C:\Users\intel\Desktop]
[path: C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\nodejs\;C:\Python38;C:\Users\intel\AppData\Local\Programs\Python\Python38\Scripts\;C:\Users\intel\AppData\Local\Programs\Python\Python38\;C:\MinGW\bin;C:\Users\intel\AppData\Local\Programs\Microsoft VS Code\bin]
回溯(最近一次呼叫最后一次):
文件“C:\Users\intel\Desktop\hackerrank.py”,第5行,在
r、 html.render()
文件“C:\Users\intel\AppData\Local\Programs\Python38\lib\site packages\requests\u html.py”,第598行,在render中
内容、结果、页面=self.session.loop.运行直到完成(self.\u异步\u呈现(url=self.url,script=script,sleep=sleep,wait=wait,content=self.html,reload=reload,scrolldown=scrolldown,timeout=timeout,keep\u page=keep\u page))
文件“C:\Users\intel\AppData\Local\Programs\Python38\lib\asyncio\base\u events.py”,第616行,运行\u直到完成
返回future.result()
文件“C:\Users\intel\AppData\Local\Programs\Python38\lib\site packages\requests\u html.py”,第512行,在异步渲染中
wait page.goto(url,选项={'timeout':int(timeout*1000)})
文件“C:\Users\intel\AppData\Local\Programs\Python38\lib\site packages\pyppeteer\page.py”,第885行,在goto中
提出错误
Pypeteer.errors.TimeoutError:超过导航超时:超过8000毫秒。
[在13.0秒内完成,退出代码为1]
[shell\u cmd:python-u“C:\Users\intel\Desktop\hackerrank.py”]
[目录:C:\Users\intel\Desktop]
[路径:C:\Windows\system32;C:\Windows;C:\Windows\system32\Wbem;C:\Windows\system32\WindowsPowerShell\v1.0\;C:\Program Files\nodejs\;C:\Python38;C:\Users\intel\AppData\Local\Programs\Python\Python38\Scripts\;C:\Users\intel\AppData\Local\Programs\Python38\;C:\MinGW\bin;C:\Users\intel\AppData\Local\Programs\Microsoft VS\Code\bin]

我在我的一篇帖子上看到了一条评论,也看到了其他人的答案,所以重新运行它,然后它就会起作用。我不明白为什么…

您收到的错误表明您没有及时收到服务器的响应

我在我的机器(Ubuntu 18.04)上成功运行了你的代码,并得到了以下结果:

Seven Days -Between Life And Death
Have you ever encountered a fake friend? If So, Try These Simple Tips To Overcome it.
Does Anybody Ever Wonder Why He’s My Everything?
Ladies, Why Should You Treat Your Face Like The Coloring Books?
Listen, Girl, Aren’t You Curious How The Last Line Could Be This Hurtful?
The girl name “Rich”
She Lost Her Beloved Mother, But Why She Asserted that Loss Was Not Just A Loss sometimes?
You Used To Try This Lonely. Have You Ever Imagine The flavor You Tried To Eat it with Your Lover?
If You Have Siblings, You Won’t Comprehend this. Have You Ever Wonder How A Child Feels Like? This Is How It Perceives.
Is It Okay To Help A Stranger?
The Nightmare Was Always Considered A Bad Omen, But It Turned Incredible Differently.
If You’re A Woman Or Girl Who Loves To Wear Lipstick, Read This Poetry.
She Wants To Spread This Poetry For Every Girl Or Woman That Was Born Just Like The Way She Was.
你必须检查你的互联网连接


或者,我建议您在管理员模式下运行idle,然后通过
idle

重新运行代码。您收到的错误表明您没有及时从服务器获得响应

我在我的机器(Ubuntu 18.04)上成功运行了你的代码,并得到了以下结果:

Seven Days -Between Life And Death
Have you ever encountered a fake friend? If So, Try These Simple Tips To Overcome it.
Does Anybody Ever Wonder Why He’s My Everything?
Ladies, Why Should You Treat Your Face Like The Coloring Books?
Listen, Girl, Aren’t You Curious How The Last Line Could Be This Hurtful?
The girl name “Rich”
She Lost Her Beloved Mother, But Why She Asserted that Loss Was Not Just A Loss sometimes?
You Used To Try This Lonely. Have You Ever Imagine The flavor You Tried To Eat it with Your Lover?
If You Have Siblings, You Won’t Comprehend this. Have You Ever Wonder How A Child Feels Like? This Is How It Perceives.
Is It Okay To Help A Stranger?
The Nightmare Was Always Considered A Bad Omen, But It Turned Incredible Differently.
If You’re A Woman Or Girl Who Loves To Wear Lipstick, Read This Poetry.
She Wants To Spread This Poetry For Every Girl Or Woman That Was Born Just Like The Way She Was.
你必须检查你的互联网连接

或者,我建议您在管理员模式下运行idle,然后通过
idle
重新运行代码