Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
crawler
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
backend
crawler
Commits
7de8312a
Commit
7de8312a
authored
Aug 03, 2020
by
litaolemo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
03a926fd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
3 deletions
+23
-3
get_query_result.py
crawler_sys/utils/get_query_result.py
+23
-3
No files found.
crawler_sys/utils/get_query_result.py
View file @
7de8312a
...
@@ -9,7 +9,7 @@ from email.mime.multipart import MIMEMultipart
...
@@ -9,7 +9,7 @@ from email.mime.multipart import MIMEMultipart
from
email.mime.application
import
MIMEApplication
from
email.mime.application
import
MIMEApplication
from
email.utils
import
formataddr
from
email.utils
import
formataddr
from
maintenance.func_send_email_with_file
import
send_file_email
from
maintenance.func_send_email_with_file
import
send_file_email
import
zipfile
es
=
Elasticsearch
([
es
=
Elasticsearch
([
{
{
'host'
:
'172.16.31.17'
,
'host'
:
'172.16.31.17'
,
...
@@ -19,6 +19,22 @@ es = Elasticsearch([
...
@@ -19,6 +19,22 @@ es = Elasticsearch([
'port'
:
9200
,
'port'
:
9200
,
}])
}])
# def zipDir(dirpath,outFullName):
# """
# 压缩指定文件夹
# :param dirpath: 目标文件夹路径
# :param outFullName: 压缩文件保存路径+xxxx.zip
# :return: 无
# """
# import zipfile
# zip = zipfile.ZipFile(outFullName,"w",zipfile.ZIP_DEFLATED)
# for path,dirnames,filenames in os.walk(dirpath):
# # 去掉目标跟路径,只对目标文件夹下边的文件及文件夹进行压缩
# fpath = path.replace(dirpath,'')
#
# for filename in filenames:
# zip.write(os.path.join(path,filename),os.path.join(fpath,filename))
# zip.close()
def
send_email_tome
():
def
send_email_tome
():
try
:
try
:
...
@@ -28,7 +44,7 @@ def send_email_tome():
...
@@ -28,7 +44,7 @@ def send_email_tome():
# toaddrs = "lixiaofang@igengmei.com"
# toaddrs = "lixiaofang@igengmei.com"
# toaddrs1 = "duanyingrong@igengmei.com"
# toaddrs1 = "duanyingrong@igengmei.com"
# toaddrs2 = "dengguangyu@igengmei.com"
# toaddrs2 = "dengguangyu@igengmei.com"
# toaddrs3 = "wangxin@igengmei.com"
# toaddrs3 = "wangxin@igengmei.com"
`
# toaddrs4 ="hezijun@igengmei.com"
# toaddrs4 ="hezijun@igengmei.com"
# toaddrs5 = "malinxi@igengmei.com"
# toaddrs5 = "malinxi@igengmei.com"
toaddrs6
=
"litao@igengmei.com"
toaddrs6
=
"litao@igengmei.com"
...
@@ -36,8 +52,12 @@ def send_email_tome():
...
@@ -36,8 +52,12 @@ def send_email_tome():
content
=
'hi all:附件为'
+
str
(
date
)
+
'的搜索词数据统计结果以及近一周的数据统计结果,请查收!'
content
=
'hi all:附件为'
+
str
(
date
)
+
'的搜索词数据统计结果以及近一周的数据统计结果,请查收!'
zipFile
=
str
(
date
)
+
".xls"
zipFile
=
str
(
date
)
+
".xls"
f
=
zipfile
.
ZipFile
(
zipFile
,
'w'
,
zipfile
.
ZIP_DEFLATED
)
f
.
write
(
date
,
zipFile
)
f
.
close
()
#zipFile = '昨日数据统计结果.xls'
#zipFile = '昨日数据统计结果.xls'
send_file_email
(
zipFile
,
email_group
=
[
"litao@igengmei.com"
],
title_str
=
content
send_file_email
(
date
+
".zip"
,
email_group
=
[
"litao@igengmei.com"
],
title_str
=
content
,
data_str
=
content
)
,
data_str
=
content
)
except
Exception
as
e
:
except
Exception
as
e
:
print
(
e
)
print
(
e
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment