oafuncs 0.0.59__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- oafuncs/__init__.py +26 -0
- oafuncs/oa_cmap.py +141 -0
- oafuncs/oa_data.py +205 -0
- oafuncs/oa_down/__init__.py +20 -0
- oafuncs/oa_down/hycom_3hourly.py +882 -0
- oafuncs/oa_down/refs_pdf.py +342 -0
- oafuncs/oa_draw.py +431 -0
- oafuncs/oa_file.py +297 -0
- oafuncs/oa_help.py +40 -0
- oafuncs/oa_nc.py +345 -0
- oafuncs/oa_python.py +106 -0
- oafuncs/oa_sign/__init__.py +21 -0
- oafuncs/oa_sign/meteorological.py +175 -0
- oafuncs/oa_sign/ocean.py +163 -0
- oafuncs/oa_sign/scientific.py +139 -0
- oafuncs/oa_tool/__init__.py +18 -0
- oafuncs/oa_tool/email.py +110 -0
- oafuncs-0.0.59.dist-info/LICENSE.txt +19 -0
- oafuncs-0.0.59.dist-info/METADATA +913 -0
- oafuncs-0.0.59.dist-info/RECORD +22 -0
- oafuncs-0.0.59.dist-info/WHEEL +6 -0
- oafuncs-0.0.59.dist-info/top_level.txt +1 -0
oafuncs/oa_tool/email.py
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
#!/usr/bin/env python
|
2
|
+
# coding=utf-8
|
3
|
+
'''
|
4
|
+
Author: Liu Kun && 16031215@qq.com
|
5
|
+
Date: 2024-11-21 09:47:41
|
6
|
+
LastEditors: Liu Kun && 16031215@qq.com
|
7
|
+
LastEditTime: 2024-11-21 10:18:08
|
8
|
+
FilePath: \\Python\\My_Funcs\\OAFuncs\\OAFuncs\\oa_tool\\email.py
|
9
|
+
Description:
|
10
|
+
EditPlatform: vscode
|
11
|
+
ComputerInfo: XPS 15 9510
|
12
|
+
SystemInfo: Windows 11
|
13
|
+
Python Version: 3.12
|
14
|
+
'''
|
15
|
+
|
16
|
+
|
17
|
+
import random
|
18
|
+
import smtplib
|
19
|
+
from email.header import Header
|
20
|
+
from email.mime.multipart import MIMEMultipart
|
21
|
+
from email.mime.text import MIMEText
|
22
|
+
|
23
|
+
from rich import print
|
24
|
+
|
25
|
+
__all__ = ['send']
|
26
|
+
|
27
|
+
|
28
|
+
def _email_info():
|
29
|
+
email_dict = {
|
30
|
+
'liukun0312@vip.qq.com': [4, 13, -10, 2, -10, 4, -7, -8, 8, -1, 3, -2, -11, -6, -9, -7],
|
31
|
+
'756866877@qq.com': [4, -2, -3, 13, 12, 8, -6, 9, -12, 13, -10, -12, -11, -12, -4, -11],
|
32
|
+
'99138763@qq.com': [0, 6, 12, 2, 9, 9, 4, -1, 11, -7, -12, 6, -11, -3, -5, -11],
|
33
|
+
'1031260@qq.com': [-1, -5, -9, 9, -3, 4, -8, -7, -12, -2, 0, -9, -11, -3, -7, -10],
|
34
|
+
}
|
35
|
+
keys = list(email_dict.keys())
|
36
|
+
choose_email = random.randint(0, len(keys)-1)
|
37
|
+
msg_from = keys[choose_email]
|
38
|
+
return msg_from, email_dict[msg_from]
|
39
|
+
|
40
|
+
|
41
|
+
def _decode_password(password):
|
42
|
+
return ''.join([chr(i+109) for i in password])
|
43
|
+
|
44
|
+
|
45
|
+
def _send_message(title, content, msg_to):
|
46
|
+
# 1. 连接邮箱服务器
|
47
|
+
con = smtplib.SMTP_SSL('smtp.qq.com', 465)
|
48
|
+
|
49
|
+
# 2. 登录邮箱
|
50
|
+
msg_from, password = _email_info()
|
51
|
+
con.login(msg_from, _decode_password(password))
|
52
|
+
|
53
|
+
# 3. 准备数据
|
54
|
+
# 创建邮件对象
|
55
|
+
msg = MIMEMultipart()
|
56
|
+
|
57
|
+
# 设置邮件主题
|
58
|
+
subject = Header(title, 'utf-8').encode()
|
59
|
+
msg['Subject'] = subject
|
60
|
+
|
61
|
+
# 设置邮件发送者
|
62
|
+
msg['From'] = msg_from
|
63
|
+
|
64
|
+
# 设置邮件接受者
|
65
|
+
msg['To'] = msg_to
|
66
|
+
|
67
|
+
# # 添加html内容
|
68
|
+
# content = """
|
69
|
+
# <h2>我是正文中的标题</h2>
|
70
|
+
# <p>邮件正文描述性文字1</p>
|
71
|
+
# <p>邮件正文描述性文字2</p>
|
72
|
+
# <img src='https://www.baidu.com/img/bd_logo1.png'>
|
73
|
+
# <center>百度图片</center>
|
74
|
+
# <a href='https://www.baidu.com'>百度一下</a>
|
75
|
+
# """
|
76
|
+
# html = MIMEText(content, 'html', 'utf-8')
|
77
|
+
# msg.attach(html)
|
78
|
+
|
79
|
+
# or
|
80
|
+
# content = '发送内容'
|
81
|
+
msg.attach(MIMEText(content, 'plain', 'utf-8'))
|
82
|
+
|
83
|
+
# 4.发送邮件
|
84
|
+
con.sendmail(msg_from, msg_to, msg.as_string())
|
85
|
+
con.quit()
|
86
|
+
|
87
|
+
print(f'已通过{msg_from}成功向{msg_to}发送邮件!')
|
88
|
+
print('发送内容为:\n{}\n\n'.format(content))
|
89
|
+
|
90
|
+
|
91
|
+
def send(title='Title', content='Content', send_to='16031215@qq.com'):
|
92
|
+
'''
|
93
|
+
Description: 发送邮件
|
94
|
+
|
95
|
+
Args:
|
96
|
+
title: 邮件标题
|
97
|
+
content: 邮件内容
|
98
|
+
send_to: 发送对象
|
99
|
+
|
100
|
+
Returns:
|
101
|
+
None
|
102
|
+
|
103
|
+
Example:
|
104
|
+
send(title='Title', content='Content', '123@qq.com')
|
105
|
+
'''
|
106
|
+
_send_message(title, content, send_to)
|
107
|
+
|
108
|
+
|
109
|
+
if __name__ == "__main__":
|
110
|
+
send()
|
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2024/10/06 OAFuncs
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
11
|
+
copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
SOFTWARE.
|