PyPtt 2.0.5__tar.gz → 2.0.6__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-2.0.5 → pyptt-2.0.6}/PKG-INFO +1 -1
- {pyptt-2.0.5 → pyptt-2.0.6}/PyPtt/__init__.py +3 -1
- {pyptt-2.0.5 → pyptt-2.0.6}/PyPtt/_api_get_user.py +9 -18
- pyptt-2.0.6/PyPtt/ssl_config.py +24 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/PyPtt.egg-info/PKG-INFO +1 -1
- {pyptt-2.0.5 → pyptt-2.0.6}/tests/test_get_user.py +6 -13
- pyptt-2.0.5/PyPtt/ssl_config.py +0 -24
- {pyptt-2.0.5 → pyptt-2.0.6}/LICENSE +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/PyPtt/PTT.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/PyPtt/_api_bucket.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/PyPtt/_api_call_status.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/PyPtt/_api_change_pw.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/PyPtt/_api_comment.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/PyPtt/_api_del_post.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/PyPtt/_api_get_board_info.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/PyPtt/_api_get_board_list.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/PyPtt/_api_get_bottom_post_list.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/PyPtt/_api_get_favourite_board.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/PyPtt/_api_get_newest_index.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/PyPtt/_api_get_post.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/PyPtt/_api_get_post_index.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/PyPtt/_api_get_post_list.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/PyPtt/_api_get_time.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/PyPtt/_api_get_waterball.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/PyPtt/_api_give_money.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/PyPtt/_api_has_new_mail.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/PyPtt/_api_loginout.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/PyPtt/_api_mail.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/PyPtt/_api_mark_post.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/PyPtt/_api_post.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/PyPtt/_api_reply_post.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/PyPtt/_api_search_user.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/PyPtt/_api_set_board_title.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/PyPtt/_api_util.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/PyPtt/api_server.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/PyPtt/check_value.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/PyPtt/command.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/PyPtt/config.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/PyPtt/connect_core.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/PyPtt/data_type.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/PyPtt/exceptions.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/PyPtt/i18n.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/PyPtt/lang_en_US.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/PyPtt/lang_zh_TW.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/PyPtt/lib_util.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/PyPtt/log.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/PyPtt/screens.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/PyPtt/service.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/PyPtt.egg-info/SOURCES.txt +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/PyPtt.egg-info/dependency_links.txt +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/PyPtt.egg-info/requires.txt +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/PyPtt.egg-info/top_level.txt +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/README.md +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/pyproject.toml +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/setup.cfg +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/setup.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/tests/test_change_pw.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/tests/test_comment.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/tests/test_del_post.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/tests/test_exceptions.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/tests/test_get_board_info.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/tests/test_get_board_list.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/tests/test_get_bottom_post_list.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/tests/test_get_favourite_boards.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/tests/test_get_mail.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/tests/test_get_newest_index.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/tests/test_get_post.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/tests/test_get_post_list.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/tests/test_get_post_parser.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/tests/test_get_time.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/tests/test_get_waterball.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/tests/test_give_money.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/tests/test_i18n.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/tests/test_init.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/tests/test_logger.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/tests/test_parse_query_post.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/tests/test_post.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/tests/test_reply_post.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/tests/test_search_user.py +0 -0
- {pyptt-2.0.5 → pyptt-2.0.6}/tests/test_service.py +0 -0
|
@@ -37,30 +37,21 @@ def get_user(api, ptt_id: str) -> Dict:
|
|
|
37
37
|
|
|
38
38
|
cmd = ''.join(cmd_list)
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
api.connect_core.send(cmd, target_list)
|
|
45
|
-
|
|
46
|
-
cmd_list = []
|
|
47
|
-
cmd_list.append('Q')
|
|
48
|
-
cmd_list.append(command.enter)
|
|
49
|
-
cmd_list.append(ptt_id)
|
|
50
|
-
cmd_list.append(command.enter)
|
|
51
|
-
|
|
52
|
-
cmd = ''.join(cmd_list)
|
|
40
|
+
# Use InTalk as a non-break target that auto-responds with the
|
|
41
|
+
# query command, and max_match=1 to prevent re-matching on
|
|
42
|
+
# intermediate screens (race condition fix).
|
|
43
|
+
query_cmd = 'Q' + command.enter + ptt_id + command.enter
|
|
53
44
|
|
|
54
45
|
target_list = [
|
|
55
46
|
connect_core.TargetUnit(screens.Target.AnyKey, break_detect=True),
|
|
56
|
-
connect_core.TargetUnit(screens.Target.InTalk,
|
|
47
|
+
connect_core.TargetUnit(screens.Target.InTalk,
|
|
48
|
+
response=query_cmd,
|
|
49
|
+
max_match=1),
|
|
57
50
|
]
|
|
58
51
|
|
|
59
|
-
index = api.connect_core.send(
|
|
60
|
-
cmd,
|
|
61
|
-
target_list)
|
|
52
|
+
index = api.connect_core.send(cmd, target_list)
|
|
62
53
|
ori_screen = api.connect_core.get_screen_queue()[-1]
|
|
63
|
-
if index
|
|
54
|
+
if index != 0:
|
|
64
55
|
raise exceptions.NoSuchUser(ptt_id)
|
|
65
56
|
# PTT1
|
|
66
57
|
# 《ID暱稱》CodingMan (專業程式 BUG 製造機)《經濟狀況》小康 ($73866)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
key = """-----BEGIN EC PARAMETERS-----
|
|
2
|
+
BggqhkjOPQMBBw==
|
|
3
|
+
-----END EC PARAMETERS-----
|
|
4
|
+
-----BEGIN EC PRIVATE KEY-----
|
|
5
|
+
MHcCAQEEIFnari/tIK4DobE9n6Q66VNwZ3iIMO4OIfYlxriiiiO2oAoGCCqGSM49
|
|
6
|
+
AwEHoUQDQgAEPB+56uUrwmG6uqxqvRWA/Q3qEMYcmyw4c/KgEKLN8IpzzH8oqfrc
|
|
7
|
+
94C1WVZ6w/VBePPn8NG4EOTSEzJoMEHKkQ==
|
|
8
|
+
-----END EC PRIVATE KEY-----
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
cert = """-----BEGIN CERTIFICATE-----
|
|
12
|
+
MIIB6jCCAY8CFAqMFEZkRx5MTexvhJ87UaaYKbmNMAoGCCqGSM49BAMCMHcxCzAJ
|
|
13
|
+
BgNVBAYTAlRXMQ4wDAYDVQQIDAVTdGF0ZTENMAsGA1UEBwwEQ2l0eTEVMBMGA1UE
|
|
14
|
+
CgwMT3JnYW5pemF0aW9uMRwwGgYDVQQLDBNPcmdhbml6YXRpb25hbCBVbml0MRQw
|
|
15
|
+
EgYDVQQDDAtDb21tb24gTmFtZTAeFw0yNjA0MDMwMzE5MjhaFw0zNjAzMzEwMzE5
|
|
16
|
+
MjhaMHcxCzAJBgNVBAYTAlRXMQ4wDAYDVQQIDAVTdGF0ZTENMAsGA1UEBwwEQ2l0
|
|
17
|
+
eTEVMBMGA1UECgwMT3JnYW5pemF0aW9uMRwwGgYDVQQLDBNPcmdhbml6YXRpb25h
|
|
18
|
+
bCBVbml0MRQwEgYDVQQDDAtDb21tb24gTmFtZTBZMBMGByqGSM49AgEGCCqGSM49
|
|
19
|
+
AwEHA0IABDwfuerlK8Jhurqsar0VgP0N6hDGHJssOHPyoBCizfCKc8x/KKn63PeA
|
|
20
|
+
tVlWesP1QXjz5/DRuBDk0hMyaDBBypEwCgYIKoZIzj0EAwIDSQAwRgIhAImZ1AX9
|
|
21
|
+
SW/lm0nyJMeAgtOm29LosMscrNNqoGz50Ha+AiEAxSLRceZ4WocAWxMNXXLqbRq5
|
|
22
|
+
FDyqLTDZ4WFPLAGhhkY=
|
|
23
|
+
-----END CERTIFICATE-----
|
|
24
|
+
"""
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import time
|
|
2
|
+
|
|
3
|
+
|
|
1
4
|
def _check_user_info(user_info, test_user):
|
|
2
5
|
assert user_info is not None, f'get_user returned None for user {test_user}'
|
|
3
6
|
assert 'ptt_id' in user_info
|
|
@@ -16,20 +19,10 @@ def test_get_user(ptt_bots):
|
|
|
16
19
|
'CodingMan',
|
|
17
20
|
]
|
|
18
21
|
|
|
19
|
-
for
|
|
22
|
+
for _ in range(100):
|
|
20
23
|
for test_user in test_users:
|
|
21
|
-
user_info =
|
|
24
|
+
user_info = ptt_bots[0].get_user(test_user)
|
|
22
25
|
_check_user_info(user_info, test_user)
|
|
23
26
|
|
|
27
|
+
time.sleep(1)
|
|
24
28
|
|
|
25
|
-
def test_get_user_ptt1_only(ptt_bots):
|
|
26
|
-
"""Tests getting user information that only exists on PTT1."""
|
|
27
|
-
ptt1_bot = ptt_bots[0]
|
|
28
|
-
|
|
29
|
-
test_users = [
|
|
30
|
-
'janice001',
|
|
31
|
-
]
|
|
32
|
-
|
|
33
|
-
for test_user in test_users:
|
|
34
|
-
user_info = ptt1_bot.get_user(test_user)
|
|
35
|
-
_check_user_info(user_info, test_user)
|
pyptt-2.0.5/PyPtt/ssl_config.py
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
key = """-----BEGIN EC PARAMETERS-----
|
|
2
|
-
BggqhkjOPQMBBw==
|
|
3
|
-
-----END EC PARAMETERS-----
|
|
4
|
-
-----BEGIN EC PRIVATE KEY-----
|
|
5
|
-
MHcCAQEEIKoC26Q5VfzkSPN5TShnQWBjUczlLrchp6TUvZz3yUvGoAoGCCqGSM49
|
|
6
|
-
AwEHoUQDQgAE9FSTa74Y+hPSchUFAl0c0oX631NUsDjDZ2BR5/5uZ0CHcPNPiObg
|
|
7
|
-
D3uXFU0vPdGIqDWIDHDf3VmshiDUD9IUgQ==
|
|
8
|
-
-----END EC PRIVATE KEY-----
|
|
9
|
-
"""
|
|
10
|
-
|
|
11
|
-
cert = """-----BEGIN CERTIFICATE-----
|
|
12
|
-
MIIB6DCCAY8CFGo6SqurrckTpxffizxr9VUuLqI9MAoGCCqGSM49BAMCMHcxCzAJ
|
|
13
|
-
BgNVBAYTAlRXMQ4wDAYDVQQIDAVTdGF0ZTENMAsGA1UEBwwEQ2l0eTEVMBMGA1UE
|
|
14
|
-
CgwMT3JnYW5pemF0aW9uMRwwGgYDVQQLDBNPcmdhbml6YXRpb25hbCBVbml0MRQw
|
|
15
|
-
EgYDVQQDDAtDb21tb24gTmFtZTAeFw0yNjA0MDIxNTExNTdaFw0zNjAzMzAxNTEx
|
|
16
|
-
NTdaMHcxCzAJBgNVBAYTAlRXMQ4wDAYDVQQIDAVTdGF0ZTENMAsGA1UEBwwEQ2l0
|
|
17
|
-
eTEVMBMGA1UECgwMT3JnYW5pemF0aW9uMRwwGgYDVQQLDBNPcmdhbml6YXRpb25h
|
|
18
|
-
bCBVbml0MRQwEgYDVQQDDAtDb21tb24gTmFtZTBZMBMGByqGSM49AgEGCCqGSM49
|
|
19
|
-
AwEHA0IABPRUk2u+GPoT0nIVBQJdHNKF+t9TVLA4w2dgUef+bmdAh3DzT4jm4A97
|
|
20
|
-
lxVNLz3RiKg1iAxw391ZrIYg1A/SFIEwCgYIKoZIzj0EAwIDRwAwRAIgSrQ9dTQ9
|
|
21
|
-
qajw32Ws/Ua9s3WvPaPa9QGwmv2Mm1Wk02sCICh8iO5eApwSnSD+PdoTVgrINx72
|
|
22
|
-
aDsfqjLNJ4BPjSDw
|
|
23
|
-
-----END CERTIFICATE-----
|
|
24
|
-
"""
|
|
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
|
|
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
|