提交 0227ff97 作者: 薛凌堃

11/15

上级 bed1863a
......@@ -286,6 +286,20 @@ class BaseCore:
charset='utf8mb4'
)
self.pool_11 = PooledDB(
creator=pymysql,
maxconnections=5,
mincached=2,
maxcached=5,
blocking=True,
host='114.116.44.11',
port=3306,
user='caiji',
password='f7s0&7qqtK',
database='clb_project',
charset='utf8mb4'
)
def check_mysql_conn(self,conn):
try:
conn.ping()
......@@ -864,7 +878,7 @@ class BaseCore:
# 发送邮箱地址
sender = '1195236739@qq.com'
# 接收邮箱地址
receiver = '1074481431@qq.com'
receiver = '1007765445@qq.com'
smtpserver = 'smtp.qq.com'
# 发送邮箱登录 账户 密码
username = '1195236739@qq.com'
......
......@@ -13,6 +13,8 @@ from selenium.webdriver.support import expected_conditions as EC
from base.BaseCore import BaseCore
baseCore = BaseCore()
log = baseCore.getLogger()
cnx_ = baseCore.cnx
cursor_ = baseCore.cursor
def createDriver():
chrome_driver = r'D:\cmd100\chromedriver.exe'
path = Service(chrome_driver)
......@@ -32,10 +34,16 @@ def flushAndGetToken():
for cookie in cookie_list:
cookies[cookie['name']] = cookie['value']
print(cookies)
insert = f"insert into QCC_token (token,cookies,create_time,fenghao_time,user_name,update_time) values ('{token}','{escape_string(cookies)}',now(),DATE_SUB(NOW(), INTERVAL 1 DAY),'{user_name}',now())"
cursor_.execute(insert)
cnx_.commit()
baseCore.close()
def getrequest_soup(headers,url):
req = requests.get(headers=headers,url=url)
result = BeautifulSoup(req.content,'html.parser')
req = requests.get(headers=headers, url=url)
result = BeautifulSoup(req.content, 'html.parser')
return result
def dojob():
......@@ -57,7 +65,7 @@ def dojob():
'Upgrade-Insecure-Requests': '1',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36'
}
url = 'https://www.qcc.com/web/search?key=%E5%B0%8F%E7%B1%B3%E9%80%9A%E8%AE%AF%E6%8A%80%E6%9C%AF%E6%9C%89%E9%99%90%E5%85%AC%E5%8F%B8'
url = 'https://www.qcc.com/api/userCenter/getAuthInfo'
soup = getrequest_soup(headers,url)
pass
......
"""
"""
......@@ -19,12 +19,12 @@ from urllib.parse import unquote
baseCore = BaseCore.BaseCore()
log = baseCore.getLogger()
baseCore = BaseCore.BaseCore()
local = threading.local()
cnx = baseCore.cnx
cursor = baseCore.cursor
# 使用连接池
cnx_ = baseCore.pool_11.connection()
cursor_ = cnx_.cursor()
cnx_ = baseCore.cnx_
cursor_ = baseCore.cursor_
pathType = 'QYNotice/'
taskType = '企业公告/证监会'
obsClient = ObsClient(
......@@ -102,6 +102,14 @@ class EsMethod(object):
log.info('更新结果:%s' % result)
# 获取当前线程的数据库连接
def get_connection():
# 检查当前线程是否已经有连接对象
if not hasattr(local, 'conn'):
# 如果没有,则创建一个连接对象并保存到thread-local中
local.conn = baseCore.pool_11.connection()
return local.conn
def getuuid():
get_timestamp_uuid = uuid.uuid1() # 根据 时间戳生成 uuid , 保证全球唯一
return get_timestamp_uuid
......@@ -211,6 +219,7 @@ def tableUpdate(retData, year, pdf_name, num,pub_time,origin):
status, create_by,
create_time, page_size, full_path.split('https://zzsn.obs.cn-north-1.myhuaweicloud.com/')[1], 'zzsn',
pub_time, origin)
cursor_.execute(Upsql, values) # 插入
cnx_.commit() # 提交
except Exception as e:
......@@ -236,7 +245,7 @@ def upload(sourceAddress,num,title,social_code,year,publishDate,createDate):
return att_id
else:
return None
from multiprocessing import Process, Queue
def main(page,p,esMethod):
# esMethod = EsMethod()
# esMethod.getFileds(index_name=esMethod.index_name)
......
"""
"""
......@@ -53,7 +53,7 @@ class EsMethod(object):
},
{
"wildcard": {
"attachmentIds.keyword": "None"
"attachmentIds.keyword": "911*"
}
}
]
......@@ -62,7 +62,7 @@ class EsMethod(object):
"sort": [
{
"createDate": {
"order": "desc"
"order": "asc"
}
}
],
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论