这种情况第一次见,到底错在哪里?

这种情况第一次见,到底错在哪里?

问题描述:


import requests
from lxml import etree
from bs4 import BeautifulSoup
import time
import pandas as pd

url = "https://labs.binance.com"
hd = {"User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36"}
resp =requests.get(url=url, headers=hd)
html = BeautifulSoup(resp,"lxml")
div = html.find("div",class_="d-flex flex-wrap align-items-center")
names = []
for i in div:
    name1 = i['alt']
    names.append(name1)

ns=pd.DataFrame(names)
date = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
path = "/Users/paul/jpn traffic/coinbase/blab"
ns.to_csv(path+date+date+'.csv',index=None)
quit()

没发现有问题啊?

但是返回:

requests.exceptions.ConnectionError: HTTPSConnectionPool(host='labs.binance.com', port=443): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fd26ad537f0>: Failed to establish a new connection: [Errno 60] Operation timed out'))

这个网址对应的网页打不开,你用PYTHON编程当然连接不上。

爬虫:从入门到入狱

这个错误好像是说链接超时