import tkinter
import requests
import threading
from bs4 import BeautifulSoup
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.110 Safari/537.36', 'Referer':'https://wallstreetcn.com/live/global' }
def getprice(url):
html=requests.get(url, headers=headers).text
soup=BeautifulSoup(html,'lxml')
price=soup.find('div',class_='price lt').get_text() #<div class="price lt" data-v-13b642d2="">12438.00</div>
return price
while True:
g=getprice('https://wallstreetcn.com/markets/indices/GER30INDEX')
top = tkinter.Tk()
label = tkinter.Label(top,text=g)
label.pack()
tkinter.mainloop()
top.wm_attributes('-topmost',1)