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'))