PyPtt 1.2.10__tar.gz → 1.2.12__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 (54) hide show
  1. {pyptt-1.2.10 → pyptt-1.2.12}/PKG-INFO +2 -1
  2. {pyptt-1.2.10 → pyptt-1.2.12}/PyPtt/PTT.py +4 -9
  3. {pyptt-1.2.10 → pyptt-1.2.12}/PyPtt/__init__.py +1 -1
  4. {pyptt-1.2.10 → pyptt-1.2.12}/PyPtt/connect_core.py +6 -2
  5. pyptt-1.2.12/PyPtt/ssl_config.py +24 -0
  6. {pyptt-1.2.10 → pyptt-1.2.12}/PyPtt.egg-info/PKG-INFO +2 -1
  7. {pyptt-1.2.10 → pyptt-1.2.12}/PyPtt.egg-info/SOURCES.txt +1 -3
  8. {pyptt-1.2.10 → pyptt-1.2.12}/README.md +2 -1
  9. pyptt-1.2.10/PyPtt/ssl/cert.pem +0 -12
  10. pyptt-1.2.10/PyPtt/ssl/key.pem +0 -8
  11. pyptt-1.2.10/PyPtt/ssl_config.py +0 -24
  12. {pyptt-1.2.10 → pyptt-1.2.12}/LICENSE +0 -0
  13. {pyptt-1.2.10 → pyptt-1.2.12}/MANIFEST.in +0 -0
  14. {pyptt-1.2.10 → pyptt-1.2.12}/PyPtt/_api_bucket.py +0 -0
  15. {pyptt-1.2.10 → pyptt-1.2.12}/PyPtt/_api_call_status.py +0 -0
  16. {pyptt-1.2.10 → pyptt-1.2.12}/PyPtt/_api_change_pw.py +0 -0
  17. {pyptt-1.2.10 → pyptt-1.2.12}/PyPtt/_api_comment.py +0 -0
  18. {pyptt-1.2.10 → pyptt-1.2.12}/PyPtt/_api_del_post.py +0 -0
  19. {pyptt-1.2.10 → pyptt-1.2.12}/PyPtt/_api_get_board_info.py +0 -0
  20. {pyptt-1.2.10 → pyptt-1.2.12}/PyPtt/_api_get_board_list.py +0 -0
  21. {pyptt-1.2.10 → pyptt-1.2.12}/PyPtt/_api_get_bottom_post_list.py +0 -0
  22. {pyptt-1.2.10 → pyptt-1.2.12}/PyPtt/_api_get_favourite_board.py +0 -0
  23. {pyptt-1.2.10 → pyptt-1.2.12}/PyPtt/_api_get_newest_index.py +0 -0
  24. {pyptt-1.2.10 → pyptt-1.2.12}/PyPtt/_api_get_post.py +0 -0
  25. {pyptt-1.2.10 → pyptt-1.2.12}/PyPtt/_api_get_post_index.py +0 -0
  26. {pyptt-1.2.10 → pyptt-1.2.12}/PyPtt/_api_get_time.py +0 -0
  27. {pyptt-1.2.10 → pyptt-1.2.12}/PyPtt/_api_get_user.py +0 -0
  28. {pyptt-1.2.10 → pyptt-1.2.12}/PyPtt/_api_give_money.py +0 -0
  29. {pyptt-1.2.10 → pyptt-1.2.12}/PyPtt/_api_has_new_mail.py +0 -0
  30. {pyptt-1.2.10 → pyptt-1.2.12}/PyPtt/_api_loginout.py +0 -0
  31. {pyptt-1.2.10 → pyptt-1.2.12}/PyPtt/_api_mail.py +0 -0
  32. {pyptt-1.2.10 → pyptt-1.2.12}/PyPtt/_api_mark_post.py +0 -0
  33. {pyptt-1.2.10 → pyptt-1.2.12}/PyPtt/_api_post.py +0 -0
  34. {pyptt-1.2.10 → pyptt-1.2.12}/PyPtt/_api_reply_post.py +0 -0
  35. {pyptt-1.2.10 → pyptt-1.2.12}/PyPtt/_api_search_user.py +0 -0
  36. {pyptt-1.2.10 → pyptt-1.2.12}/PyPtt/_api_set_board_title.py +0 -0
  37. {pyptt-1.2.10 → pyptt-1.2.12}/PyPtt/_api_util.py +0 -0
  38. {pyptt-1.2.10 → pyptt-1.2.12}/PyPtt/check_value.py +0 -0
  39. {pyptt-1.2.10 → pyptt-1.2.12}/PyPtt/command.py +0 -0
  40. {pyptt-1.2.10 → pyptt-1.2.12}/PyPtt/config.py +0 -0
  41. {pyptt-1.2.10 → pyptt-1.2.12}/PyPtt/data_type.py +0 -0
  42. {pyptt-1.2.10 → pyptt-1.2.12}/PyPtt/exceptions.py +0 -0
  43. {pyptt-1.2.10 → pyptt-1.2.12}/PyPtt/i18n.py +0 -0
  44. {pyptt-1.2.10 → pyptt-1.2.12}/PyPtt/lang_en_US.py +0 -0
  45. {pyptt-1.2.10 → pyptt-1.2.12}/PyPtt/lang_zh_TW.py +0 -0
  46. {pyptt-1.2.10 → pyptt-1.2.12}/PyPtt/lib_util.py +0 -0
  47. {pyptt-1.2.10 → pyptt-1.2.12}/PyPtt/log.py +0 -0
  48. {pyptt-1.2.10 → pyptt-1.2.12}/PyPtt/screens.py +0 -0
  49. {pyptt-1.2.10 → pyptt-1.2.12}/PyPtt/service.py +0 -0
  50. {pyptt-1.2.10 → pyptt-1.2.12}/PyPtt.egg-info/dependency_links.txt +0 -0
  51. {pyptt-1.2.10 → pyptt-1.2.12}/PyPtt.egg-info/requires.txt +0 -0
  52. {pyptt-1.2.10 → pyptt-1.2.12}/PyPtt.egg-info/top_level.txt +0 -0
  53. {pyptt-1.2.10 → pyptt-1.2.12}/setup.cfg +0 -0
  54. {pyptt-1.2.10 → pyptt-1.2.12}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyPtt
3
- Version: 1.2.10
3
+ Version: 1.2.12
4
4
  Summary: PyPtt
5
5
  Home-page: https://pyptt.cc/
6
6
  Author: CodingMan
@@ -44,6 +44,7 @@ Requires-Dist: PyYAML
44
44
  #### PyPtt (PTT Library) 是一套 Pure Python PTT API 是目前支援最完整的 PTT API。具備大部分常用功能,無論推文、發文、取得文章、取得信件、寄信、發 P 幣、丟水球,你都可以在這裡找到完整的使用範例
45
45
  #### 使用帳號登入,支援使用登入之後才可以使用的功能,例如:推文、發文、寄信、發 P 幣等等
46
46
  #### 本專案意旨在提供 PTT 自動化機器人函式庫,無意違反任何 PTT 站方規範。如有牴觸,請馬上告知。
47
+ #### 由於 PTT 封鎖雲端連線,建議在雲端以外的環境使用。
47
48
  ####
48
49
  #### Pypi: https://pypi.org/project/PyPtt/
49
50
  <img src="https://raw.githubusercontent.com/PyPtt/PyPtt/master/docs/_static/login_1.0.gif" width="560">
@@ -2,7 +2,7 @@
2
2
 
3
3
  import functools
4
4
  import threading
5
- from typing import Dict, Tuple, Callable, List, Optional, Any
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 的更新。預設為 **True**。
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', True)
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')
@@ -1,4 +1,4 @@
1
- __version__ = '1.2.10'
1
+ __version__ = '1.2.12'
2
2
 
3
3
  from .PTT import API
4
4
  from .data_type import *
@@ -26,10 +26,11 @@ from . import ssl_config
26
26
 
27
27
  websockets.http.USER_AGENT += f' PyPtt/{PyPtt.__version__}'
28
28
 
29
- ssl_context = ssl.create_default_context()
29
+ ssl_context = None
30
30
 
31
31
 
32
32
  def ssl_init():
33
+ global ssl_context
33
34
 
34
35
  cert_file = tempfile.NamedTemporaryFile(delete=False, suffix='.pem')
35
36
  cert_file.write(ssl_config.cert.encode('utf-8'))
@@ -40,14 +41,17 @@ def ssl_init():
40
41
  cert_file.close()
41
42
  key_file.close()
42
43
 
44
+ ssl_context = ssl.create_default_context()
45
+ ssl_context.check_hostname = False
43
46
  ssl_context.load_cert_chain(certfile=cert_file.name, keyfile=key_file.name)
47
+ ssl_context.minimum_version = ssl.TLSVersion.TLSv1_2
48
+ ssl_context.verify_mode = ssl.CERT_NONE
44
49
 
45
50
  os.unlink(cert_file.name)
46
51
  os.unlink(key_file.name)
47
52
 
48
53
 
49
54
  ssl_init()
50
- ssl_context.minimum_version = ssl.TLSVersion.TLSv1_2
51
55
 
52
56
 
53
57
  class TargetUnit:
@@ -0,0 +1,24 @@
1
+ key = """-----BEGIN EC PARAMETERS-----
2
+ BggqhkjOPQMBBw==
3
+ -----END EC PARAMETERS-----
4
+ -----BEGIN EC PRIVATE KEY-----
5
+ MHcCAQEEIO+xEROY5c66+lghuzon4+QSQjNMjYOsIcZTGu9kvdUooAoGCCqGSM49
6
+ AwEHoUQDQgAEpjnp/z3Dr9rh+vP35MvZAUdgVo9cr4JBYXGbYlxtc0WyNuSz0NyS
7
+ dM6vy7SZ5wSM3jhqd1//7MzGZ3bQquANuw==
8
+ -----END EC PRIVATE KEY-----
9
+ """
10
+
11
+ cert = """-----BEGIN CERTIFICATE-----
12
+ MIIB6jCCAY8CFGuxNOT4MXnzlELPVff39pImhwuBMAoGCCqGSM49BAMCMHcxCzAJ
13
+ BgNVBAYTAlRXMQ4wDAYDVQQIDAVTdGF0ZTENMAsGA1UEBwwEQ2l0eTEVMBMGA1UE
14
+ CgwMT3JnYW5pemF0aW9uMRwwGgYDVQQLDBNPcmdhbml6YXRpb25hbCBVbml0MRQw
15
+ EgYDVQQDDAtDb21tb24gTmFtZTAeFw0yNDA1MDUwNTU2NTVaFw0zNDA1MDMwNTU2
16
+ NTVaMHcxCzAJBgNVBAYTAlRXMQ4wDAYDVQQIDAVTdGF0ZTENMAsGA1UEBwwEQ2l0
17
+ eTEVMBMGA1UECgwMT3JnYW5pemF0aW9uMRwwGgYDVQQLDBNPcmdhbml6YXRpb25h
18
+ bCBVbml0MRQwEgYDVQQDDAtDb21tb24gTmFtZTBZMBMGByqGSM49AgEGCCqGSM49
19
+ AwEHA0IABKY56f89w6/a4frz9+TL2QFHYFaPXK+CQWFxm2JcbXNFsjbks9DcknTO
20
+ r8u0mecEjN44andf/+zMxmd20KrgDbswCgYIKoZIzj0EAwIDSQAwRgIhAOeKSR2I
21
+ Ru+Ois0V+G6ab3Hwu7E182D+pBHvjQHEouW9AiEApcJFk95BQU2R4KCup1wnUnxw
22
+ bnffr8eMeWFiqo74EX0=
23
+ -----END CERTIFICATE-----
24
+ """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyPtt
3
- Version: 1.2.10
3
+ Version: 1.2.12
4
4
  Summary: PyPtt
5
5
  Home-page: https://pyptt.cc/
6
6
  Author: CodingMan
@@ -44,6 +44,7 @@ Requires-Dist: PyYAML
44
44
  #### PyPtt (PTT Library) 是一套 Pure Python PTT API 是目前支援最完整的 PTT API。具備大部分常用功能,無論推文、發文、取得文章、取得信件、寄信、發 P 幣、丟水球,你都可以在這裡找到完整的使用範例
45
45
  #### 使用帳號登入,支援使用登入之後才可以使用的功能,例如:推文、發文、寄信、發 P 幣等等
46
46
  #### 本專案意旨在提供 PTT 自動化機器人函式庫,無意違反任何 PTT 站方規範。如有牴觸,請馬上告知。
47
+ #### 由於 PTT 封鎖雲端連線,建議在雲端以外的環境使用。
47
48
  ####
48
49
  #### Pypi: https://pypi.org/project/PyPtt/
49
50
  <img src="https://raw.githubusercontent.com/PyPtt/PyPtt/master/docs/_static/login_1.0.gif" width="560">
@@ -46,6 +46,4 @@ PyPtt.egg-info/PKG-INFO
46
46
  PyPtt.egg-info/SOURCES.txt
47
47
  PyPtt.egg-info/dependency_links.txt
48
48
  PyPtt.egg-info/requires.txt
49
- PyPtt.egg-info/top_level.txt
50
- PyPtt/ssl/cert.pem
51
- PyPtt/ssl/key.pem
49
+ PyPtt.egg-info/top_level.txt
@@ -11,6 +11,7 @@
11
11
  #### PyPtt (PTT Library) 是一套 Pure Python PTT API 是目前支援最完整的 PTT API。具備大部分常用功能,無論推文、發文、取得文章、取得信件、寄信、發 P 幣、丟水球,你都可以在這裡找到完整的使用範例
12
12
  #### 使用帳號登入,支援使用登入之後才可以使用的功能,例如:推文、發文、寄信、發 P 幣等等
13
13
  #### 本專案意旨在提供 PTT 自動化機器人函式庫,無意違反任何 PTT 站方規範。如有牴觸,請馬上告知。
14
+ #### 由於 PTT 封鎖雲端連線,建議在雲端以外的環境使用。
14
15
  ####
15
16
  #### Pypi: https://pypi.org/project/PyPtt/
16
17
  <img src="https://raw.githubusercontent.com/PyPtt/PyPtt/master/docs/_static/login_1.0.gif" width="560">
@@ -33,4 +34,4 @@ pip install PyPtt
33
34
 
34
35
  ## 贊助清單
35
36
 
36
- #### leftc
37
+ #### leftc
@@ -1,12 +0,0 @@
1
- -----BEGIN CERTIFICATE-----
2
- MIIBrTCCAVOgAwIBAgIUac6b6rzwFIEa9VBigD0jYlE96NkwCgYIKoZIzj0EAwIw
3
- RTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoMGElu
4
- dGVybmV0IFdpZGdpdHMgUHR5IEx0ZDAeFw0yNDA0MTEwNzA4NDJaFw0zNDA0MDkw
5
- NzA4NDJaMEUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYD
6
- VQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQwWTATBgcqhkjOPQIBBggqhkjO
7
- PQMBBwNCAASGL9hdVzbi6QTzJk409Ne+ZMnK2iQcm6VcAacTyJvQqCEIQysJtRs+
8
- /53XjdOORHgDfsMK94T4CG6TbULqCT+uoyEwHzAdBgNVHQ4EFgQUoR2GjY1nFWvR
9
- gTyu936KF11kvL0wCgYIKoZIzj0EAwIDSAAwRQIhAOQ33wHzCv7F2yI8Ye4BHdtZ
10
- SOW7IgU5rRkFlMPhTXj6AiBGE0+EZPNctmBfj2N8s6lYIxsGmlcSnWVxlQvj6XQc
11
- Uw==
12
- -----END CERTIFICATE-----
@@ -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-----
@@ -1,24 +0,0 @@
1
-
2
- cert = """-----BEGIN CERTIFICATE-----
3
- MIIBrTCCAVOgAwIBAgIUac6b6rzwFIEa9VBigD0jYlE96NkwCgYIKoZIzj0EAwIw
4
- RTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoMGElu
5
- dGVybmV0IFdpZGdpdHMgUHR5IEx0ZDAeFw0yNDA0MTEwNzA4NDJaFw0zNDA0MDkw
6
- NzA4NDJaMEUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYD
7
- VQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQwWTATBgcqhkjOPQIBBggqhkjO
8
- PQMBBwNCAASGL9hdVzbi6QTzJk409Ne+ZMnK2iQcm6VcAacTyJvQqCEIQysJtRs+
9
- /53XjdOORHgDfsMK94T4CG6TbULqCT+uoyEwHzAdBgNVHQ4EFgQUoR2GjY1nFWvR
10
- gTyu936KF11kvL0wCgYIKoZIzj0EAwIDSAAwRQIhAOQ33wHzCv7F2yI8Ye4BHdtZ
11
- SOW7IgU5rRkFlMPhTXj6AiBGE0+EZPNctmBfj2N8s6lYIxsGmlcSnWVxlQvj6XQc
12
- Uw==
13
- -----END CERTIFICATE-----
14
- """
15
-
16
- key = """-----BEGIN EC PARAMETERS-----
17
- BggqhkjOPQMBBw==
18
- -----END EC PARAMETERS-----
19
- -----BEGIN EC PRIVATE KEY-----
20
- MHcCAQEEIO6ELVhrKQdW1YcoP3VOGW4XKGyVmlVdPHxou5XDDlU3oAoGCCqGSM49
21
- AwEHoUQDQgAEhi/YXVc24ukE8yZONPTXvmTJytokHJulXAGnE8ib0KghCEMrCbUb
22
- Pv+d143TjkR4A37DCveE+Ahuk21C6gk/rg==
23
- -----END EC PRIVATE KEY-----
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