PyPtt 1.2.9__tar.gz → 1.2.11__tar.gz
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.
- {pyptt-1.2.9 → pyptt-1.2.11}/PKG-INFO +1 -1
- {pyptt-1.2.9 → pyptt-1.2.11}/PyPtt/PTT.py +4 -9
- {pyptt-1.2.9 → pyptt-1.2.11}/PyPtt/__init__.py +1 -1
- {pyptt-1.2.9 → pyptt-1.2.11}/PyPtt/connect_core.py +14 -10
- pyptt-1.2.11/PyPtt/ssl_config.py +25 -0
- {pyptt-1.2.9 → pyptt-1.2.11}/PyPtt.egg-info/PKG-INFO +1 -1
- {pyptt-1.2.9 → pyptt-1.2.11}/PyPtt.egg-info/SOURCES.txt +1 -3
- pyptt-1.2.9/PyPtt/ssl/cert.pem +0 -12
- pyptt-1.2.9/PyPtt/ssl/key.pem +0 -8
- pyptt-1.2.9/PyPtt/ssl_config.py +0 -25
- {pyptt-1.2.9 → pyptt-1.2.11}/LICENSE +0 -0
- {pyptt-1.2.9 → pyptt-1.2.11}/MANIFEST.in +0 -0
- {pyptt-1.2.9 → pyptt-1.2.11}/PyPtt/_api_bucket.py +0 -0
- {pyptt-1.2.9 → pyptt-1.2.11}/PyPtt/_api_call_status.py +0 -0
- {pyptt-1.2.9 → pyptt-1.2.11}/PyPtt/_api_change_pw.py +0 -0
- {pyptt-1.2.9 → pyptt-1.2.11}/PyPtt/_api_comment.py +0 -0
- {pyptt-1.2.9 → pyptt-1.2.11}/PyPtt/_api_del_post.py +0 -0
- {pyptt-1.2.9 → pyptt-1.2.11}/PyPtt/_api_get_board_info.py +0 -0
- {pyptt-1.2.9 → pyptt-1.2.11}/PyPtt/_api_get_board_list.py +0 -0
- {pyptt-1.2.9 → pyptt-1.2.11}/PyPtt/_api_get_bottom_post_list.py +0 -0
- {pyptt-1.2.9 → pyptt-1.2.11}/PyPtt/_api_get_favourite_board.py +0 -0
- {pyptt-1.2.9 → pyptt-1.2.11}/PyPtt/_api_get_newest_index.py +0 -0
- {pyptt-1.2.9 → pyptt-1.2.11}/PyPtt/_api_get_post.py +0 -0
- {pyptt-1.2.9 → pyptt-1.2.11}/PyPtt/_api_get_post_index.py +0 -0
- {pyptt-1.2.9 → pyptt-1.2.11}/PyPtt/_api_get_time.py +0 -0
- {pyptt-1.2.9 → pyptt-1.2.11}/PyPtt/_api_get_user.py +0 -0
- {pyptt-1.2.9 → pyptt-1.2.11}/PyPtt/_api_give_money.py +0 -0
- {pyptt-1.2.9 → pyptt-1.2.11}/PyPtt/_api_has_new_mail.py +0 -0
- {pyptt-1.2.9 → pyptt-1.2.11}/PyPtt/_api_loginout.py +0 -0
- {pyptt-1.2.9 → pyptt-1.2.11}/PyPtt/_api_mail.py +0 -0
- {pyptt-1.2.9 → pyptt-1.2.11}/PyPtt/_api_mark_post.py +0 -0
- {pyptt-1.2.9 → pyptt-1.2.11}/PyPtt/_api_post.py +0 -0
- {pyptt-1.2.9 → pyptt-1.2.11}/PyPtt/_api_reply_post.py +0 -0
- {pyptt-1.2.9 → pyptt-1.2.11}/PyPtt/_api_search_user.py +0 -0
- {pyptt-1.2.9 → pyptt-1.2.11}/PyPtt/_api_set_board_title.py +0 -0
- {pyptt-1.2.9 → pyptt-1.2.11}/PyPtt/_api_util.py +0 -0
- {pyptt-1.2.9 → pyptt-1.2.11}/PyPtt/check_value.py +0 -0
- {pyptt-1.2.9 → pyptt-1.2.11}/PyPtt/command.py +0 -0
- {pyptt-1.2.9 → pyptt-1.2.11}/PyPtt/config.py +0 -0
- {pyptt-1.2.9 → pyptt-1.2.11}/PyPtt/data_type.py +0 -0
- {pyptt-1.2.9 → pyptt-1.2.11}/PyPtt/exceptions.py +0 -0
- {pyptt-1.2.9 → pyptt-1.2.11}/PyPtt/i18n.py +0 -0
- {pyptt-1.2.9 → pyptt-1.2.11}/PyPtt/lang_en_US.py +0 -0
- {pyptt-1.2.9 → pyptt-1.2.11}/PyPtt/lang_zh_TW.py +0 -0
- {pyptt-1.2.9 → pyptt-1.2.11}/PyPtt/lib_util.py +0 -0
- {pyptt-1.2.9 → pyptt-1.2.11}/PyPtt/log.py +0 -0
- {pyptt-1.2.9 → pyptt-1.2.11}/PyPtt/screens.py +0 -0
- {pyptt-1.2.9 → pyptt-1.2.11}/PyPtt/service.py +0 -0
- {pyptt-1.2.9 → pyptt-1.2.11}/PyPtt.egg-info/dependency_links.txt +0 -0
- {pyptt-1.2.9 → pyptt-1.2.11}/PyPtt.egg-info/requires.txt +0 -0
- {pyptt-1.2.9 → pyptt-1.2.11}/PyPtt.egg-info/top_level.txt +0 -0
- {pyptt-1.2.9 → pyptt-1.2.11}/README.md +0 -0
- {pyptt-1.2.9 → pyptt-1.2.11}/setup.cfg +0 -0
- {pyptt-1.2.9 → pyptt-1.2.11}/setup.py +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import functools
|
|
4
4
|
import threading
|
|
5
|
-
from typing import Dict, Tuple,
|
|
5
|
+
from typing import Dict, Tuple, List, Optional, Any
|
|
6
6
|
|
|
7
7
|
from . import __version__
|
|
8
8
|
from . import _api_bucket
|
|
@@ -50,7 +50,7 @@ class API:
|
|
|
50
50
|
logger_callback (Callable): PyPtt 顯示訊息的 callback。預設為 None。
|
|
51
51
|
port (int): PyPtt 連線的 port。預設為 **23**。
|
|
52
52
|
host (:ref:`host`): PyPtt 連線的 PTT 伺服器。預設為 **PTT1**。
|
|
53
|
-
check_update (bool): 是否檢查 PyPtt 的更新。預設為 **
|
|
53
|
+
check_update (bool): 是否檢查 PyPtt 的更新。預設為 **False**。
|
|
54
54
|
|
|
55
55
|
Returns:
|
|
56
56
|
None
|
|
@@ -178,7 +178,7 @@ class API:
|
|
|
178
178
|
|
|
179
179
|
log.logger.info('PyPtt', i18n.initialization, '...', i18n.done)
|
|
180
180
|
|
|
181
|
-
check_update = kwargs.get('check_update',
|
|
181
|
+
check_update = kwargs.get('check_update', False)
|
|
182
182
|
check_value.check_type(check_update, bool, 'check_update')
|
|
183
183
|
|
|
184
184
|
if check_update:
|
|
@@ -195,7 +195,7 @@ class API:
|
|
|
195
195
|
log.logger.info(i18n.current_version, __version__)
|
|
196
196
|
|
|
197
197
|
def __del__(self):
|
|
198
|
-
if log.logger:
|
|
198
|
+
if log and log.logger:
|
|
199
199
|
log.logger.debug(i18n.goodbye)
|
|
200
200
|
|
|
201
201
|
def login(self, ptt_id: str, ptt_pw: str, kick_other_session: bool = False) -> None:
|
|
@@ -1058,8 +1058,3 @@ class API:
|
|
|
1058
1058
|
|
|
1059
1059
|
def fast_post_step1(self, sign_file):
|
|
1060
1060
|
_api_post.fast_post_step1(self, sign_file)
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
if __name__ == '__main__':
|
|
1064
|
-
print('PyPtt v ' + __version__)
|
|
1065
|
-
print('Maintained by CodingMan')
|
|
@@ -4,6 +4,7 @@ import asyncio
|
|
|
4
4
|
import os.path
|
|
5
5
|
import ssl
|
|
6
6
|
import telnetlib
|
|
7
|
+
import tempfile
|
|
7
8
|
import threading
|
|
8
9
|
import time
|
|
9
10
|
import traceback
|
|
@@ -25,24 +26,27 @@ from . import ssl_config
|
|
|
25
26
|
|
|
26
27
|
websockets.http.USER_AGENT += f' PyPtt/{PyPtt.__version__}'
|
|
27
28
|
|
|
28
|
-
|
|
29
|
+
ssl_context = ssl.create_default_context()
|
|
29
30
|
|
|
30
31
|
|
|
31
32
|
def ssl_init():
|
|
32
|
-
if not os.path.exists(f'{_script_path}/ssl'):
|
|
33
|
-
os.mkdir(f'{_script_path}/ssl')
|
|
34
33
|
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
cert_file = tempfile.NamedTemporaryFile(delete=False, suffix='.pem')
|
|
35
|
+
cert_file.write(ssl_config.cert.encode('utf-8'))
|
|
37
36
|
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
key_file = tempfile.NamedTemporaryFile(delete=False, suffix='.pem')
|
|
38
|
+
key_file.write(ssl_config.key.encode('utf-8'))
|
|
40
39
|
|
|
40
|
+
cert_file.close()
|
|
41
|
+
key_file.close()
|
|
41
42
|
|
|
42
|
-
|
|
43
|
+
ssl_context.load_cert_chain(certfile=cert_file.name, keyfile=key_file.name)
|
|
43
44
|
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
os.unlink(cert_file.name)
|
|
46
|
+
os.unlink(key_file.name)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
ssl_init()
|
|
46
50
|
ssl_context.minimum_version = ssl.TLSVersion.TLSv1_2
|
|
47
51
|
|
|
48
52
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
key = """-----BEGIN EC PARAMETERS-----
|
|
2
|
+
BggqhkjOPQMBBw==
|
|
3
|
+
-----END EC PARAMETERS-----
|
|
4
|
+
-----BEGIN EC PRIVATE KEY-----
|
|
5
|
+
MHcCAQEEIPxohnK+7ol1VI18vCxwWWWLNmxifkx+S+24j+ECvtrIoAoGCCqGSM49
|
|
6
|
+
AwEHoUQDQgAEtI001t4IcID4JF/LoVUNrZqIaGIRB4IdN5FK8umkXZiHMoQBjSLN
|
|
7
|
+
mWZBF8YNj7nTJsE4mnaEagAi9hniZG8Jdg==
|
|
8
|
+
-----END EC PRIVATE KEY-----
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
cert = """-----BEGIN CERTIFICATE-----
|
|
12
|
+
MIICEjCCAbegAwIBAgIUTd2xAuhGMpBTofRPR0iFQhFrjG4wCgYIKoZIzj0EAwIw
|
|
13
|
+
dzELMAkGA1UEBhMCVFcxDjAMBgNVBAgMBVN0YXRlMQ0wCwYDVQQHDARDaXR5MRUw
|
|
14
|
+
EwYDVQQKDAxPcmdhbml6YXRpb24xHDAaBgNVBAsME09yZ2FuaXphdGlvbmFsIFVu
|
|
15
|
+
aXQxFDASBgNVBAMMC0NvbW1vbiBOYW1lMB4XDTI0MDUwMTA3NDc0OFoXDTM0MDQy
|
|
16
|
+
OTA3NDc0OFowdzELMAkGA1UEBhMC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VcAacTyJvQqCEIQysJtRs+
|
|
8
|
-
/53XjdOORHgDfsMK94T4CG6TbULqCT+uoyEwHzAdBgNVHQ4EFgQUoR2GjY1nFWvR
|
|
9
|
-
gTyu936KF11kvL0wCgYIKoZIzj0EAwIDSAAwRQIhAOQ33wHzCv7F2yI8Ye4BHdtZ
|
|
10
|
-
SOW7IgU5rRkFlMPhTXj6AiBGE0+EZPNctmBfj2N8s6lYIxsGmlcSnWVxlQvj6XQc
|
|
11
|
-
Uw==
|
|
12
|
-
-----END CERTIFICATE-----
|
pyptt-1.2.9/PyPtt/ssl/key.pem
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
-----BEGIN EC PARAMETERS-----
|
|
2
|
-
BggqhkjOPQMBBw==
|
|
3
|
-
-----END EC PARAMETERS-----
|
|
4
|
-
-----BEGIN EC PRIVATE KEY-----
|
|
5
|
-
MHcCAQEEIO6ELVhrKQdW1YcoP3VOGW4XKGyVmlVdPHxou5XDDlU3oAoGCCqGSM49
|
|
6
|
-
AwEHoUQDQgAEhi/YXVc24ukE8yZONPTXvmTJytokHJulXAGnE8ib0KghCEMrCbUb
|
|
7
|
-
Pv+d143TjkR4A37DCveE+Ahuk21C6gk/rg==
|
|
8
|
-
-----END EC PRIVATE KEY-----
|
pyptt-1.2.9/PyPtt/ssl_config.py
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
|
|
3
|
-
cert = """-----BEGIN CERTIFICATE-----
|
|
4
|
-
MIIBrTCCAVOgAwIBAgIUac6b6rzwFIEa9VBigD0jYlE96NkwCgYIKoZIzj0EAwIw
|
|
5
|
-
RTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoMGElu
|
|
6
|
-
dGVybmV0IFdpZGdpdHMgUHR5IEx0ZDAeFw0yNDA0MTEwNzA4NDJaFw0zNDA0MDkw
|
|
7
|
-
NzA4NDJaMEUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYD
|
|
8
|
-
VQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQwWTATBgcqhkjOPQIBBggqhkjO
|
|
9
|
-
PQMBBwNCAASGL9hdVzbi6QTzJk409Ne+ZMnK2iQcm6VcAacTyJvQqCEIQysJtRs+
|
|
10
|
-
/53XjdOORHgDfsMK94T4CG6TbULqCT+uoyEwHzAdBgNVHQ4EFgQUoR2GjY1nFWvR
|
|
11
|
-
gTyu936KF11kvL0wCgYIKoZIzj0EAwIDSAAwRQIhAOQ33wHzCv7F2yI8Ye4BHdtZ
|
|
12
|
-
SOW7IgU5rRkFlMPhTXj6AiBGE0+EZPNctmBfj2N8s6lYIxsGmlcSnWVxlQvj6XQc
|
|
13
|
-
Uw==
|
|
14
|
-
-----END CERTIFICATE-----
|
|
15
|
-
"""
|
|
16
|
-
|
|
17
|
-
key = """-----BEGIN EC PARAMETERS-----
|
|
18
|
-
BggqhkjOPQMBBw==
|
|
19
|
-
-----END EC PARAMETERS-----
|
|
20
|
-
-----BEGIN EC PRIVATE KEY-----
|
|
21
|
-
MHcCAQEEIO6ELVhrKQdW1YcoP3VOGW4XKGyVmlVdPHxou5XDDlU3oAoGCCqGSM49
|
|
22
|
-
AwEHoUQDQgAEhi/YXVc24ukE8yZONPTXvmTJytokHJulXAGnE8ib0KghCEMrCbUb
|
|
23
|
-
Pv+d143TjkR4A37DCveE+Ahuk21C6gk/rg==
|
|
24
|
-
-----END EC PRIVATE KEY-----
|
|
25
|
-
"""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|