Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
zzsn_spider
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
王景浩
zzsn_spider
Commits
b58ca335
提交
b58ca335
authored
2月 28, 2024
作者:
薛凌堃
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
最新版港股公告
上级
5d5fed47
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
10 行增加
和
34 行删除
+10
-34
东方财富网-港股公告-2.py
comData/noticeReport/东方财富网-港股公告-2.py
+10
-34
没有找到文件。
comData/noticeReport/东方财富网-港股公告-2.py
浏览文件 @
b58ca335
"""
"""
"""
"""
港股公告-更换采用接口的方式
港股公告-更换采用接口的方式
"""
"""
import
urllib3
urllib3
.
disable_warnings
(
urllib3
.
exceptions
.
InsecureRequestWarning
)
import
os
import
os
import
subprocess
import
subprocess
import
sys
import
sys
...
@@ -214,35 +215,6 @@ def ifInstert(short_name, social_code, title, info_date):
...
@@ -214,35 +215,6 @@ def ifInstert(short_name, social_code, title, info_date):
else
:
else
:
return
ifexist
return
ifexist
def
sendKafka
(
social_code
,
newsUrl
,
dic_news
):
try
:
producer
=
KafkaProducer
(
bootstrap_servers
=
[
'114.115.159.144:9092'
],
max_request_size
=
1024
*
1024
*
20
)
kafka_result
=
producer
.
send
(
"researchReportNoticeTopic"
,
json
.
dumps
(
dic_news
,
ensure_ascii
=
False
)
.
encode
(
'utf8'
))
print
(
kafka_result
.
get
(
timeout
=
10
))
dic_result
=
{
'success'
:
'ture'
,
'message'
:
'操作成功'
,
'code'
:
'200'
,
}
log
.
info
(
dic_result
)
return
True
except
Exception
as
e
:
dic_result
=
{
'success'
:
'false'
,
'message'
:
'操作失败'
,
'code'
:
'204'
,
'e'
:
e
}
state
=
0
takeTime
=
baseCore
.
getTimeCost
(
start_time
,
time
.
time
())
baseCore
.
recordLog
(
social_code
,
taskType
,
state
,
takeTime
,
newsUrl
,
'Kafka操作失败'
)
log
.
info
(
dic_result
)
return
False
def
GetContent
(
pdf_url
,
info_url
,
pdf_name
,
social_code
,
year
,
pub_time
,
start_time
,
com_name
,
num
):
def
GetContent
(
pdf_url
,
info_url
,
pdf_name
,
social_code
,
year
,
pub_time
,
start_time
,
com_name
,
num
):
# 上传至华为云服务器
# 上传至华为云服务器
retData
=
uptoOBS
(
pdf_url
,
pdf_name
,
8
,
social_code
)
retData
=
uptoOBS
(
pdf_url
,
pdf_name
,
8
,
social_code
)
...
@@ -326,7 +298,11 @@ def gonggao_info(dic_info):
...
@@ -326,7 +298,11 @@ def gonggao_info(dic_info):
pass
pass
else
:
else
:
return
return
while
True
:
if
len
(
code
.
split
(
'.HK'
)[
0
])
<
5
:
code
=
'0'
+
code
else
:
break
#https://np-anotice-stock.eastmoney.com/api/security/ann?sr=-1&page_size=50&page_index=1&ann_type=H&client_source=web&stock_list=00175&f_node=0
#https://np-anotice-stock.eastmoney.com/api/security/ann?sr=-1&page_size=50&page_index=1&ann_type=H&client_source=web&stock_list=00175&f_node=0
url
=
f
'https://np-anotice-stock.eastmoney.com/api/security/ann?sr=-1&page_size=50&page_index=1&ann_type=H&client_source=web&stock_list={code.split(".HK")[0]}&f_node=0'
url
=
f
'https://np-anotice-stock.eastmoney.com/api/security/ann?sr=-1&page_size=50&page_index=1&ann_type=H&client_source=web&stock_list={code.split(".HK")[0]}&f_node=0'
for
n1
in
range
(
0
,
3
):
for
n1
in
range
(
0
,
3
):
...
@@ -414,7 +390,7 @@ def gonggao_info(dic_info):
...
@@ -414,7 +390,7 @@ def gonggao_info(dic_info):
continue
continue
else
:
else
:
log
.
info
(
f
'======={com_name}========{code}===已存在'
)
log
.
info
(
f
'======={com_name}========{code}===已存在'
)
continue
return
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
#从redis中读取social_code'
#从redis中读取social_code'
...
@@ -427,7 +403,7 @@ if __name__ =='__main__':
...
@@ -427,7 +403,7 @@ if __name__ =='__main__':
start_time
=
time
.
time
()
start_time
=
time
.
time
()
# 获取企业信息
# 获取企业信息
# social_code = baseCore.redicPullData('NoticeEnterprise:ggqy_socialCode_add')
# social_code = baseCore.redicPullData('NoticeEnterprise:ggqy_socialCode_add')
social_code
=
'
91330000747735638J
'
social_code
=
'
ZZSN23030800000224
'
if
not
social_code
:
if
not
social_code
:
time
.
sleep
(
20
)
time
.
sleep
(
20
)
continue
continue
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论