"""
    新浪财经美股企业动态
"""
import requests
from bs4 import BeautifulSoup
from base.BaseCore import BaseCore
baseCore = BaseCore()
log = baseCore.getLogger()
cnx = baseCore.cnx
cursor = baseCore.cursor
def getinfomation(social_code):
    selectSql = f"select * from mgzqjywyh_list where state = '2' and xydm='{social_code}' "
    cursor.execute(selectSql)
    data = cursor.fetchone()
    cnx.commit()
    data = list(data)
    cursor.close()
    cnx.close()
    return data

def getrequests(url):
    req = requests.get(url)
    soup = BeautifulSoup(req.text,'html.parser')
    return soup
if __name__ == "__main__":
    social_code = ''
    #从redis中获取企业信用代码
    data = getinfomation(social_code)
    com_code = data[6]
    #拼接链接
    # url = f'http://biz.finance.sina.com.cn/usstock/usstock_news.php?symbol={com_code}'
    url = 'http://biz.finance.sina.com.cn/usstock/usstock_news.php?symbol=AAPL'
    soup = getrequests(url)

