PyPtt 1.2.18__tar.gz → 1.2.19__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.
Files changed (52) hide show
  1. {pyptt-1.2.18 → pyptt-1.2.19}/PKG-INFO +1 -1
  2. {pyptt-1.2.18 → pyptt-1.2.19}/PyPtt/__init__.py +1 -1
  3. {pyptt-1.2.18 → pyptt-1.2.19}/PyPtt/_api_comment.py +1 -1
  4. {pyptt-1.2.18 → pyptt-1.2.19}/PyPtt/_api_get_post.py +5 -5
  5. {pyptt-1.2.18 → pyptt-1.2.19}/PyPtt/_api_mark_post.py +2 -2
  6. {pyptt-1.2.18 → pyptt-1.2.19}/PyPtt/_api_reply_post.py +1 -1
  7. {pyptt-1.2.18 → pyptt-1.2.19}/PyPtt/_api_util.py +2 -3
  8. {pyptt-1.2.18 → pyptt-1.2.19}/PyPtt/connect_core.py +8 -3
  9. {pyptt-1.2.18 → pyptt-1.2.19}/PyPtt/screens.py +1 -1
  10. pyptt-1.2.19/PyPtt/ssl_config.py +24 -0
  11. {pyptt-1.2.18 → pyptt-1.2.19}/PyPtt.egg-info/PKG-INFO +1 -1
  12. pyptt-1.2.18/PyPtt/ssl_config.py +0 -24
  13. {pyptt-1.2.18 → pyptt-1.2.19}/LICENSE +0 -0
  14. {pyptt-1.2.18 → pyptt-1.2.19}/MANIFEST.in +0 -0
  15. {pyptt-1.2.18 → pyptt-1.2.19}/PyPtt/PTT.py +0 -0
  16. {pyptt-1.2.18 → pyptt-1.2.19}/PyPtt/_api_bucket.py +0 -0
  17. {pyptt-1.2.18 → pyptt-1.2.19}/PyPtt/_api_call_status.py +0 -0
  18. {pyptt-1.2.18 → pyptt-1.2.19}/PyPtt/_api_change_pw.py +0 -0
  19. {pyptt-1.2.18 → pyptt-1.2.19}/PyPtt/_api_del_post.py +0 -0
  20. {pyptt-1.2.18 → pyptt-1.2.19}/PyPtt/_api_get_board_info.py +0 -0
  21. {pyptt-1.2.18 → pyptt-1.2.19}/PyPtt/_api_get_board_list.py +0 -0
  22. {pyptt-1.2.18 → pyptt-1.2.19}/PyPtt/_api_get_bottom_post_list.py +0 -0
  23. {pyptt-1.2.18 → pyptt-1.2.19}/PyPtt/_api_get_favourite_board.py +0 -0
  24. {pyptt-1.2.18 → pyptt-1.2.19}/PyPtt/_api_get_newest_index.py +0 -0
  25. {pyptt-1.2.18 → pyptt-1.2.19}/PyPtt/_api_get_post_index.py +0 -0
  26. {pyptt-1.2.18 → pyptt-1.2.19}/PyPtt/_api_get_time.py +0 -0
  27. {pyptt-1.2.18 → pyptt-1.2.19}/PyPtt/_api_get_user.py +0 -0
  28. {pyptt-1.2.18 → pyptt-1.2.19}/PyPtt/_api_give_money.py +0 -0
  29. {pyptt-1.2.18 → pyptt-1.2.19}/PyPtt/_api_has_new_mail.py +0 -0
  30. {pyptt-1.2.18 → pyptt-1.2.19}/PyPtt/_api_loginout.py +0 -0
  31. {pyptt-1.2.18 → pyptt-1.2.19}/PyPtt/_api_mail.py +0 -0
  32. {pyptt-1.2.18 → pyptt-1.2.19}/PyPtt/_api_post.py +0 -0
  33. {pyptt-1.2.18 → pyptt-1.2.19}/PyPtt/_api_search_user.py +0 -0
  34. {pyptt-1.2.18 → pyptt-1.2.19}/PyPtt/_api_set_board_title.py +0 -0
  35. {pyptt-1.2.18 → pyptt-1.2.19}/PyPtt/check_value.py +0 -0
  36. {pyptt-1.2.18 → pyptt-1.2.19}/PyPtt/command.py +0 -0
  37. {pyptt-1.2.18 → pyptt-1.2.19}/PyPtt/config.py +0 -0
  38. {pyptt-1.2.18 → pyptt-1.2.19}/PyPtt/data_type.py +0 -0
  39. {pyptt-1.2.18 → pyptt-1.2.19}/PyPtt/exceptions.py +0 -0
  40. {pyptt-1.2.18 → pyptt-1.2.19}/PyPtt/i18n.py +0 -0
  41. {pyptt-1.2.18 → pyptt-1.2.19}/PyPtt/lang_en_US.py +0 -0
  42. {pyptt-1.2.18 → pyptt-1.2.19}/PyPtt/lang_zh_TW.py +0 -0
  43. {pyptt-1.2.18 → pyptt-1.2.19}/PyPtt/lib_util.py +0 -0
  44. {pyptt-1.2.18 → pyptt-1.2.19}/PyPtt/log.py +0 -0
  45. {pyptt-1.2.18 → pyptt-1.2.19}/PyPtt/service.py +0 -0
  46. {pyptt-1.2.18 → pyptt-1.2.19}/PyPtt.egg-info/SOURCES.txt +0 -0
  47. {pyptt-1.2.18 → pyptt-1.2.19}/PyPtt.egg-info/dependency_links.txt +0 -0
  48. {pyptt-1.2.18 → pyptt-1.2.19}/PyPtt.egg-info/requires.txt +0 -0
  49. {pyptt-1.2.18 → pyptt-1.2.19}/PyPtt.egg-info/top_level.txt +0 -0
  50. {pyptt-1.2.18 → pyptt-1.2.19}/README.md +0 -0
  51. {pyptt-1.2.18 → pyptt-1.2.19}/setup.cfg +0 -0
  52. {pyptt-1.2.18 → pyptt-1.2.19}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyPtt
3
- Version: 1.2.18
3
+ Version: 1.2.19
4
4
  Summary: PyPtt
5
5
  Home-page: https://pyptt.cc/
6
6
  Author: CodingMan
@@ -1,4 +1,4 @@
1
- __version__ = '1.2.18'
1
+ __version__ = '1.2.19'
2
2
 
3
3
  from .PTT import API
4
4
  from .data_type import *
@@ -130,7 +130,7 @@ def comment(api, board: str, push_type: data_type.CommentType, push_content: str
130
130
  check_value.check_type(board, str, 'board')
131
131
 
132
132
  if not isinstance(push_type, data_type.CommentType):
133
- raise TypeError(f'CommentType must be data_type.CommentType')
133
+ raise TypeError('CommentType must be data_type.CommentType')
134
134
 
135
135
  check_value.check_type(push_content, str, 'push_content')
136
136
  if post_aid is not None:
@@ -129,7 +129,7 @@ def _get_post(api, board: str, post_aid: Optional[str] = None, post_index: int =
129
129
  ]
130
130
 
131
131
  index = api.connect_core.send(cmd, target_list)
132
- ori_screen = api.connect_core.get_screen_queue()[-1]
132
+ last_screen = api.connect_core.get_screen_queue()[-1]
133
133
 
134
134
  post = {
135
135
  PostField.board: None,
@@ -158,13 +158,13 @@ def _get_post(api, board: str, post_aid: Optional[str] = None, post_index: int =
158
158
  if index < 0 or index == 1:
159
159
  # 文章被刪除
160
160
  log.logger.debug(i18n.post_deleted)
161
- log.logger.debug('OriScreen', ori_screen)
161
+ log.logger.debug('OriScreen', last_screen)
162
162
 
163
- cursor_line = [line for line in ori_screen.split(
163
+ cursor_line = [line for line in last_screen.split(
164
164
  '\n') if line.startswith(api.cursor)]
165
165
 
166
166
  if len(cursor_line) != 1:
167
- raise exceptions.UnknownError(ori_screen)
167
+ raise exceptions.UnknownError(last_screen)
168
168
 
169
169
  cursor_line = cursor_line[0]
170
170
  log.logger.debug('CursorLine', cursor_line)
@@ -214,7 +214,7 @@ def _get_post(api, board: str, post_aid: Optional[str] = None, post_index: int =
214
214
  lock_post, post_author, post_title, post_aid, post_web, post_money, list_date, push_number, post_index = \
215
215
  _api_util.parse_query_post(
216
216
  api,
217
- ori_screen)
217
+ last_screen)
218
218
 
219
219
  if lock_post:
220
220
  post.update({
@@ -21,7 +21,7 @@ def mark_post(api, mark_type: int, board: str, post_aid: str, post_index: int, s
21
21
  raise exceptions.UnregisteredUser(lib_util.get_current_func_name())
22
22
 
23
23
  if not isinstance(mark_type, data_type.MarkType):
24
- raise TypeError(f'mark_type must be data_type.MarkType')
24
+ raise TypeError('mark_type must be data_type.MarkType')
25
25
 
26
26
  check_value.check_type(board, str, 'board')
27
27
  if post_aid is not None:
@@ -29,7 +29,7 @@ def mark_post(api, mark_type: int, board: str, post_aid: str, post_index: int, s
29
29
  check_value.check_type(post_index, int, 'PostIndex')
30
30
 
31
31
  if not isinstance(search_type, data_type.SearchType):
32
- raise TypeError(f'search_type must be data_type.SearchType')
32
+ raise TypeError('search_type must be data_type.SearchType')
33
33
 
34
34
  if search_condition is not None:
35
35
  check_value.check_type(search_condition, str, 'SearchCondition')
@@ -17,7 +17,7 @@ def reply_post(api, reply_to: data_type.ReplyTo, board: str, content: str, sign_
17
17
  raise exceptions.RequireLogin(i18n.require_login)
18
18
 
19
19
  if not isinstance(reply_to, data_type.ReplyTo):
20
- raise TypeError(f'ReplyTo must be data_type.ReplyTo')
20
+ raise TypeError('ReplyTo must be data_type.ReplyTo')
21
21
 
22
22
  check_value.check_type(board, str, 'board')
23
23
  check_value.check_type(content, str, 'content')
@@ -33,8 +33,7 @@ def get_content(api, post_mode: bool = True):
33
33
  connect_core.TargetUnit(screens.Target.InPost, log_level=log.DEBUG, break_detect=True),
34
34
  connect_core.TargetUnit(screens.Target.PostNoContent, log_level=log.DEBUG, break_detect=True),
35
35
  # 動畫文章
36
- connect_core.TargetUnit(screens.Target.Animation, response=command.go_main_menu_type_q,
37
- break_detect_after_send=True),
36
+ connect_core.TargetUnit(screens.Target.Animation, response='n'),
38
37
  ]
39
38
 
40
39
  line_from_pattern = re.compile(r'[\d]+~[\d]+')
@@ -395,7 +394,7 @@ def goto_board(api, board: str, refresh: bool = False, end: bool = False) -> Non
395
394
  # 這裡可能因為發現第一次進入看板會有進版畫面,一般來說都可以在 target_list 找到對應的標的
396
395
  # 但某些看板會卡在進版動畫中,但沒有顯示任意鍵繼續或互動是動畫,所以當 index == -1 (表示找不到標的 timeout 了)
397
396
  # 可以嘗試修改 cmd_list
398
- index = api.connect_core.send(cmd, target_list, refresh=current_refresh)
397
+ api.connect_core.send(cmd, target_list, refresh=current_refresh)
399
398
 
400
399
  if end:
401
400
  cmd_list = []
@@ -95,8 +95,13 @@ class TargetUnit:
95
95
  if target == cursor:
96
96
  if not any(line.startswith(target) for line in screen.split('\n')):
97
97
  return False
98
- elif target not in screen:
99
- return False
98
+ elif isinstance(target, str):
99
+ if target not in screen:
100
+ return False
101
+ elif isinstance(target, list):
102
+ if not any(t in screen for t in target):
103
+ return False
104
+
100
105
  self._current_match += 1
101
106
  return True
102
107
 
@@ -211,7 +216,7 @@ class API(object):
211
216
  if self.config.connect_mode == data_type.ConnectMode.TELNET:
212
217
  self._core = telnetlib.Telnet(telnet_host, self.config.port)
213
218
  else:
214
- if not threading.current_thread() is threading.main_thread():
219
+ if threading.current_thread() is not threading.main_thread():
215
220
  loop = asyncio.new_event_loop()
216
221
  asyncio.set_event_loop(loop)
217
222
 
@@ -23,7 +23,7 @@ class Target:
23
23
  PTT1_QueryPost = [
24
24
  '請按任意鍵繼續',
25
25
  '文章代碼(AID):',
26
- '文章網址:'
26
+ ('文章網址:', '本看板目前不提供文章網址')
27
27
  ]
28
28
 
29
29
  PTT2_QueryPost = [
@@ -0,0 +1,24 @@
1
+ key = """-----BEGIN EC PARAMETERS-----
2
+ BggqhkjOPQMBBw==
3
+ -----END EC PARAMETERS-----
4
+ -----BEGIN EC PRIVATE KEY-----
5
+ MHcCAQEEIG4BOpPiAtfiRgc2DydA/wkdxOGaxwH+exd4MXa4Cja8oAoGCCqGSM49
6
+ AwEHoUQDQgAEDS/OWw/BDHH2l2pZO6LPmWqNUKmuPNSJ7xbtVxsIpuJwNxntrch6
7
+ qbU2VrVjYuzRAjQvjff9rgC9kJLGi+Z2OQ==
8
+ -----END EC PRIVATE KEY-----
9
+ """
10
+
11
+ cert = """-----BEGIN CERTIFICATE-----
12
+ MIIB6DCCAY8CFAnIVb8H7lNPfebaSJJTQ0vn9OfhMAoGCCqGSM49BAMCMHcxCzAJ
13
+ BgNVBAYTAlRXMQ4wDAYDVQQIDAVTdGF0ZTENMAsGA1UEBwwEQ2l0eTEVMBMGA1UE
14
+ CgwMT3JnYW5pemF0aW9uMRwwGgYDVQQLDBNPcmdhbml6YXRpb25hbCBVbml0MRQw
15
+ EgYDVQQDDAtDb21tb24gTmFtZTAeFw0yNTA3MTAwNjM3MDNaFw0zNTA3MDgwNjM3
16
+ MDNaMHcxCzAJBgNVBAYTAlRXMQ4wDAYDVQQIDAVTdGF0ZTENMAsGA1UEBwwEQ2l0
17
+ eTEVMBMGA1UECgwMT3JnYW5pemF0aW9uMRwwGgYDVQQLDBNPcmdhbml6YXRpb25h
18
+ bCBVbml0MRQwEgYDVQQDDAtDb21tb24gTmFtZTBZMBMGByqGSM49AgEGCCqGSM49
19
+ AwEHA0IABA0vzlsPwQxx9pdqWTuiz5lqjVCprjzUie8W7VcbCKbicDcZ7a3Ieqm1
20
+ Nla1Y2Ls0QI0L433/a4AvZCSxovmdjkwCgYIKoZIzj0EAwIDRwAwRAIgWFa5O1DU
21
+ knIrEdqRN1AoSccEbIVQM9q3W+IC0xFHeU8CIDOfBI4Tn40oE+85IslFMVLZaXGK
22
+ eD4SF5N8kWIN6UxT
23
+ -----END CERTIFICATE-----
24
+ """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyPtt
3
- Version: 1.2.18
3
+ Version: 1.2.19
4
4
  Summary: PyPtt
5
5
  Home-page: https://pyptt.cc/
6
6
  Author: CodingMan
@@ -1,24 +0,0 @@
1
- key = """-----BEGIN EC PARAMETERS-----
2
- BggqhkjOPQMBBw==
3
- -----END EC PARAMETERS-----
4
- -----BEGIN EC PRIVATE KEY-----
5
- MHcCAQEEIJbgsRW2TKkVA9Xes0BF+mZmt9xt55PQVkS/5fW7MSGRoAoGCCqGSM49
6
- AwEHoUQDQgAEovYlaBBO4yItJL4E64G3vnJ/35Y086ZHhasVSBcOHaWZ3gvPfEQ6
7
- bGzjAHcP0nvIHujHWZ0n+WiKHx5YrNBqdQ==
8
- -----END EC PRIVATE KEY-----
9
- """
10
-
11
- cert = """-----BEGIN CERTIFICATE-----
12
- MIIB6TCCAY8CFBH32z9ttIrOFfV1B3S83UMpXJ8rMAoGCCqGSM49BAMCMHcxCzAJ
13
- BgNVBAYTAlRXMQ4wDAYDVQQIDAVTdGF0ZTENMAsGA1UEBwwEQ2l0eTEVMBMGA1UE
14
- CgwMT3JnYW5pemF0aW9uMRwwGgYDVQQLDBNPcmdhbml6YXRpb25hbCBVbml0MRQw
15
- EgYDVQQDDAtDb21tb24gTmFtZTAeFw0yNTA2MTEwMTI1NTZaFw0zNTA2MDkwMTI1
16
- NTZaMHcxCzAJBgNVBAYTAlRXMQ4wDAYDVQQIDAVTdGF0ZTENMAsGA1UEBwwEQ2l0
17
- eTEVMBMGA1UECgwMT3JnYW5pemF0aW9uMRwwGgYDVQQLDBNPcmdhbml6YXRpb25h
18
- bCBVbml0MRQwEgYDVQQDDAtDb21tb24gTmFtZTBZMBMGByqGSM49AgEGCCqGSM49
19
- AwEHA0IABKL2JWgQTuMiLSS+BOuBt75yf9+WNPOmR4WrFUgXDh2lmd4Lz3xEOmxs
20
- 4wB3D9J7yB7ox1mdJ/loih8eWKzQanUwCgYIKoZIzj0EAwIDSAAwRQIhAOptXAaR
21
- UNGwem1Rrhu3u1xjXjquzYugsE4wEqe4ZtINAiAn8kWuKxsy+BLc3R4VOzzQ33zW
22
- RVgyl1y5FA4471yinw==
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