Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
zzsn_spider
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
王景浩
zzsn_spider
Commits
f97acdf8
提交
f97acdf8
authored
11月 15, 2023
作者:
薛凌堃
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
11/15
上级
0261ed3e
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
60 行增加
和
12 行删除
+60
-12
reits.py
REITs专题数据/reits.py
+24
-12
BaseCore.py
base/BaseCore.py
+36
-0
baseinfo1113.py
comData/BaseInfo_qcc/baseinfo1113.py
+0
-0
没有找到文件。
REITs专题数据/reits.py
浏览文件 @
f97acdf8
impor
t
os
impor
t
os
...
...
@@ -388,7 +388,7 @@ def zhengquanqihuo(wb,file_path):
#上海交易所 http://www.sse.com.cn/home/search/index.shtml?webswd=REITs
def
sse
():
def
sse
(
wb
,
file_path
):
url
=
'http://query.sse.com.cn/search/getESSearchDoc.do?page=0&limit=10&publishTimeEnd=&publishTimeStart=&orderByDirection=DESC&orderByKey=score&searchMode=fuzzy&spaceId=3&keyword=REITs&siteName=sse&keywordPosition=title
%2
Cpaper_content&channelId=10001&channelCode=8640
%2
C8641
%2
C8642
%2
C8643
%2
C8644
%2
C8645
%2
C8646
%2
C8647
%2
C8648
%2
C8649
%2
C8650
%2
C8651
%2
C8652
%2
C8653
%2
C8654
%2
C8655
%2
C8656
%2
C8657
%2
C8658
%2
C8659
%2
C8660
%2
C8661
%2
C8685
%2
C9348
%2
C12632
%2
C12768
%2
C12769
%2
C12770
%2
C12771
%2
C12772
%2
C12773
%2
C12774
%2
C12775
%2
C12776
%2
C12777
%2
C12778
%2
C12779
%2
C12780
%2
C12781
%2
C12782
%2
C12783
%2
C12784
%2
C12785
%2
C12786
%2
C12787
%2
C12788
%2
C12789
%2
C12790
%2
C12791
%2
C12792
%2
C12793
%2
C12794
%2
C12795
%2
C12796
%2
C12797
%2
C12798
%2
C12799
%2
C12800
%2
C12801
%2
C12802
%2
C12803
%2
C12804
%2
C12805
%2
C12806
%2
C12807
%2
C12808
%2
C12809
%2
C12810
%2
C12811
%2
C12812
%2
C13061
%2
C13282
%2
C13283
%2
C13284
%2
C13285
%2
C13286
%2
C13287
%2
C13288
%2
C13289
%2
C13294
%2
C13364
%2
C13365
%2
C13366
%2
C13367
%2
C14595
%2
C14596
%2
C14597
%2
C14598
%2
C14599
%2
C14600
%2
C14601
%2
C14602
%2
C14603
%2
C14604
%2
C14605
%2
C14606&trackId=50619067167713018335655119683810&_=1699508921761'
headers
=
{
'Accept'
:
'*/*'
,
...
...
@@ -454,7 +454,7 @@ def sse():
'原文链接'
:
newsUrl
,
'发文时间'
:
''
,
'发文机构'
:
''
,
'发文字号'
:
pubHao
,
'发文字号'
:
''
,
'摘要'
:
summary
,
'正文'
:
content
,
'附件名称'
:
fu_jian_name
,
...
...
@@ -468,10 +468,13 @@ def sse():
# print(content_)
# # 将链接替换为绝对路径
contentWithTag
=
policy
.
paserUrl
(
content_
,
newsUrl
)
pubHao
=
contentWithTag
.
find
(
'p'
,
style
=
'text-align: center;'
)
.
text
.
strip
(
' '
)
if
'〔'
in
pubHao
:
pass
else
:
try
:
pubHao
=
contentWithTag
.
find
(
'p'
,
style
=
'text-align: center;'
)
.
text
.
strip
(
' '
)
if
'〔'
in
pubHao
:
pass
else
:
pubHao
=
''
except
:
pubHao
=
''
# print(contentWithTag)
content
=
contentWithTag
.
text
...
...
@@ -482,11 +485,18 @@ def sse():
for
fujian
in
fujian_list
:
file_href
=
fujian
[
'href'
]
file_name
=
fujian
.
text
.
strip
(
' '
)
rename_file
=
f
'{str(num)}_{publishDate}_{file_name}'
category
=
os
.
path
.
splitext
(
file_href
)[
1
]
if
category
in
file_name
:
pass
else
:
file_name
=
file_name
+
category
rename_file
=
f
'{str(num)}_{publishDate}_{file_name}'
.
replace
(
'
\\
'
,
''
)
.
replace
(
'/'
,
''
)
.
replace
(
'|'
,
''
)
.
replace
(
'>'
,
''
)
.
replace
(
'<'
,
''
)
.
replace
(
'*'
,
''
)
.
replace
(
':'
,
''
)
.
replace
(
'?'
,
''
)
.
replace
(
'—'
,
''
)
fu_jian_name
+=
rename_file
+
'
\n
'
fu_jian_href
+=
file_href
+
'
\n
'
policy
.
downloadfile
(
file_href
,
f
'{path}/{rename_file}'
)
try
:
policy
.
downloadfile
(
file_href
,
f
'{path}/{rename_file}'
)
except
:
log
.
info
(
f
'--{page}-{num}======{newsUrl}'
)
dic_info
=
{
'序号'
:
num
,
'标题'
:
title
,
...
...
@@ -615,8 +625,9 @@ def beijing():
if
__name__
==
"__main__"
:
file_path
=
f
'data/REITs
专题数据
.xlsx'
file_path
=
f
'data/REITs
国家改革发展委员会
.xlsx'
wb
=
policy
.
createfile
(
file_path
)
# reform(wb,file_path)
zhengquanqihuo
(
wb
,
file_path
)
# zhengquanqihuo(wb,file_path)
sse
(
wb
,
file_path
)
# zhengquanqihuo()
\ No newline at end of file
base/BaseCore.py
浏览文件 @
f97acdf8
# 核心工具包
import
os
import
random
import
smtplib
import
socket
import
sys
import
time
from
email.header
import
Header
from
email.mime.application
import
MIMEApplication
from
email.mime.multipart
import
MIMEMultipart
from
email.mime.text
import
MIMEText
import
MySQLdb
import
logbook
...
...
@@ -852,3 +857,34 @@ class BaseCore:
result
=
obsClient
.
putContent
(
'zzsn'
,
pathType
+
name
,
content
=
response
.
content
)
# resp = obsClient.putFile('zzsn', pathType + name, file_path='要上传的那个文件的本地路径')
return
result
def
sendEmail
(
self
,
file_name
):
file
=
open
(
file_name
,
'rb'
)
.
read
()
# 发送邮箱地址
sender
=
'1195236739@qq.com'
# 接收邮箱地址
receiver
=
'1074481431@qq.com'
smtpserver
=
'smtp.qq.com'
# 发送邮箱登录 账户 密码
username
=
'1195236739@qq.com'
password
=
'gatvszshadvpgjci'
maile_title
=
'企业基本信息采集情况'
message
=
MIMEMultipart
()
message
[
'From'
]
=
sender
message
[
'To'
]
=
receiver
message
[
'Subject'
]
=
Header
(
maile_title
,
'utf-8'
)
message
.
attach
(
MIMEText
(
'企业基本信息采集情况'
,
'plain'
,
'utf-8'
))
xlsxApart
=
MIMEApplication
(
file
)
xlsxApart
.
add_header
(
'Content-Disposition'
,
'attachment'
,
filename
=
'企业基本信息采集情况.xlsx'
)
message
.
attach
(
xlsxApart
)
smtpObj
=
smtplib
.
SMTP_SSL
(
smtpserver
)
# 注意:如果遇到发送失败的情况(提示远程主机拒接连接),这里要使用SMTP_SSL方法
smtpObj
.
connect
(
smtpserver
,
port
=
465
)
smtpObj
.
login
(
username
,
password
)
smtpObj
.
sendmail
(
sender
,
receiver
,
message
.
as_string
())
print
(
"邮件发送成功!!!"
)
smtpObj
.
quit
()
comData/BaseInfo_qcc/baseinfo1113.py
0 → 100644
浏览文件 @
f97acdf8
差异被折叠。
点击展开。
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论