为什么我得到这个ERRNO 110-Python要求

时间:2018-09-24 18:06:07

标签: python beautifulsoup python-requests

我想知道在尝试对此URL进行请求时出了什么问题。这是我的代码:

import requests as rq
from bs4 import BeautifulSoup

def make_request(Url):
    result = rq.get(Url)
    soup = BeautifulSoup(result.content, "html.parser")
    events = soup.find_all("a")
    for i in events:
        print(i)
make_request("https://web.archive.org/web/20180507100019/https://bravenewcoin.com/industry-resources/events-calendar/bitcoin-and-blockchain-events/")

我认为问题是URL,在那种情况下,我该怎么做才能解决该问题并解析该网站的内容?非常感谢!

2 个答案:

答案 0 :(得分:0)

您的函数中有两个网址,

https://web.archive.org/web/20180507100019/
https://bravenewcoin.com/industry-resources/events-calendar/bitcoin-and-blockchain-events/

请一次提供一个网址。

答案 1 :(得分:0)

您可以一次请求两个网址。您似乎需要此网址

urls = [
"https://web.archive.org/web/20180507100019/",
"https://bravenewcoin.com/industry-resources/events-calendar/bitcoin-and-blockchain-events/"]
for url in urls:
    make_request(url)