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
67b86bd3
Commit
67b86bd3
authored
Jul 23, 2021
by
李小芳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
827549ca
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
9 deletions
+7
-9
save_gengmei_data_to_csv.py
dev/xinyang_ask_tag/save_gengmei_data_to_csv.py
+5
-7
save_soyoung_data_to_csv.py
dev/xinyang_ask_tag/save_soyoung_data_to_csv.py
+2
-2
No files found.
dev/xinyang_ask_tag/save_gengmei_data_to_csv.py
View file @
67b86bd3
...
...
@@ -36,7 +36,7 @@ def send_email_tome():
content
=
'爬取更美热搜前100的词召回的商品,内容详见表格'
text_apart
=
MIMEText
(
content
,
'plain'
,
"utf-8"
)
zip_file_week
=
'gengmei_service.csv'
zip_file_week
=
'gengmei_service.csv
.gz
'
zip_apart_week
=
MIMEApplication
(
open
(
zip_file_week
,
'rb'
)
.
read
())
zip_apart_week
.
add_header
(
'Content-Disposition'
,
'attachment'
,
filename
=
zip_file_week
)
...
...
@@ -49,7 +49,7 @@ def send_email_tome():
m
[
'Subject'
]
=
'新氧商品信息'
try
:
server
=
smtplib
.
SMTP_SSL
(
'smtp.exmail.qq.com'
,
465
)
server
=
smtplib
.
SMTP_SSL
(
'smtp.exmail.qq.com'
,
465
,
timeout
=
1200
)
server
.
login
(
from_addrs
,
password
)
server
.
sendmail
(
from_addrs
,
[
toaddrs
],
m
.
as_string
())
print
(
'success'
)
...
...
@@ -125,7 +125,7 @@ if __name__ == '__main__':
all_data
=
[]
city_list
=
[
"北京"
,
"上海"
,
"广州"
,
"深圳"
,
"杭州"
,
"成都"
,
"重庆"
,
"南京"
,
"武汉"
,
"长沙"
,
"郑州"
,
"西安"
]
for
city_name
in
city_list
:
file_name
=
"gengmei_save_data_
"
+
today
+
city_name
+
".txt"
file_name
=
"gengmei_save_data_
2021-07-22"
+
city_name
+
".txt"
if
os
.
path
.
exists
(
file_name
):
open_file
=
open
(
file_name
,
"r"
,
encoding
=
"utf-8"
)
print
(
file_name
)
...
...
@@ -139,10 +139,8 @@ if __name__ == '__main__':
if
len
(
all_data
):
res
=
pd
.
DataFrame
(
all_data
)
res
.
to_csv
(
"gengmei_service.csv"
,
encoding
=
"gb18030"
)
# f = zipfile.ZipFile("gengmei_service.csv", "w", zipfile.ZIP_DEFLATED)
#
# send_email_tome()
res
.
to_csv
(
"gengmei_service.csv.gz"
,
compression
=
'gzip'
,
index
=
False
,
encoding
=
"gb18030"
)
send_email_tome
()
print
(
time
.
time
()
-
begin
)
print
(
"end"
)
dev/xinyang_ask_tag/save_soyoung_data_to_csv.py
View file @
67b86bd3
...
...
@@ -36,7 +36,7 @@ def send_email_tome():
content
=
'爬取新氧热搜前100的词召回的商品,内容详见表格'
text_apart
=
MIMEText
(
content
,
'plain'
,
"utf-8"
)
zip_file_week
=
'soyoung_service.csv'
zip_file_week
=
'soyoung_service.csv
.gz
'
zip_apart_week
=
MIMEApplication
(
open
(
zip_file_week
,
'rb'
)
.
read
())
zip_apart_week
.
add_header
(
'Content-Disposition'
,
'attachment'
,
filename
=
zip_file_week
)
...
...
@@ -103,7 +103,7 @@ if __name__ == '__main__':
if
len
(
all_data
):
res
=
pd
.
DataFrame
(
all_data
)
res
.
to_csv
(
"soyoung_service.csv
"
,
encoding
=
"gb18030"
)
res
.
to_csv
(
"soyoung_service.csv
.gz"
,
compression
=
'gzip'
,
index
=
False
,
encoding
=
"gb18030"
)
send_email_tome
()
print
(
time
.
time
()
-
begin
)
...
...
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