8 lines
358 B
Python
8 lines
358 B
Python
import urllib.request,json,time
|
|
r = urllib.request.Request(
|
|
"https://push2.eastmoney.com/api/qt/stock/get?secid=116.00700&fields=f43,f170&fltt=2",
|
|
headers={"User-Agent": "Mozilla/5.0"})
|
|
start = time.time()
|
|
resp = json.loads(urllib.request.urlopen(r, timeout=5).read())
|
|
print(f"OK {time.time()-start:.1f}s price={resp.get('data',{}).get('f43','?')}")
|