-
Notifications
You must be signed in to change notification settings - Fork 0
/
mailapi.py
46 lines (38 loc) · 1.18 KB
/
mailapi.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env python
# encoding: utf-8
"""
> FileName: mailapi.py
> Author: FZH
> Mail: [email protected]
> CreatedTime: 2020-03-22 13:20
"""
import os
import requests
url = "http://127.0.0.1:5000/fmax"
def mail_send():
data = {'mail_to': '[email protected]',
'mail_title': 'TEST_TITLE',
'mail_body': '接口更新完毕'}
files = []
response = requests.request("POST",
url,
data=data,
files=files)
return response.text.encode('utf8')
def mail_send_append():
data = {'mail_to': '[email protected]',
'mail_title': 'TEST_TITLE',
'mail_body': '接口更新完毕'}
des_file = os.path.join(os.path.dirname(__file__),
'fmax.xlsx')
files = {'file': open(des_file, 'rb')}
headers = {
'Content-Type': 'multipart/form-data'
}
response = requests.request("POST",
url,
data=data,
files=files)
return response.text.encode('utf8')
if __name__ == '__main__':
mail_send_append()