PyPtt 1.2.11__tar.gz → 1.2.13__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.11 → pyptt-1.2.13}/PKG-INFO +2 -1
- {pyptt-1.2.11 → pyptt-1.2.13}/PyPtt/__init__.py +1 -1
- {pyptt-1.2.11 → pyptt-1.2.13}/PyPtt/connect_core.py +15 -5
- {pyptt-1.2.11 → pyptt-1.2.13}/PyPtt/i18n.py +1 -0
- pyptt-1.2.13/PyPtt/ssl_config.py +24 -0
- {pyptt-1.2.11 → pyptt-1.2.13}/PyPtt.egg-info/PKG-INFO +2 -1
- {pyptt-1.2.11 → pyptt-1.2.13}/README.md +2 -1
- {pyptt-1.2.11 → pyptt-1.2.13}/setup.py +3 -1
- pyptt-1.2.11/PyPtt/ssl_config.py +0 -25
- {pyptt-1.2.11 → pyptt-1.2.13}/LICENSE +0 -0
- {pyptt-1.2.11 → pyptt-1.2.13}/MANIFEST.in +0 -0
- {pyptt-1.2.11 → pyptt-1.2.13}/PyPtt/PTT.py +0 -0
- {pyptt-1.2.11 → pyptt-1.2.13}/PyPtt/_api_bucket.py +0 -0
- {pyptt-1.2.11 → pyptt-1.2.13}/PyPtt/_api_call_status.py +0 -0
- {pyptt-1.2.11 → pyptt-1.2.13}/PyPtt/_api_change_pw.py +0 -0
- {pyptt-1.2.11 → pyptt-1.2.13}/PyPtt/_api_comment.py +0 -0
- {pyptt-1.2.11 → pyptt-1.2.13}/PyPtt/_api_del_post.py +0 -0
- {pyptt-1.2.11 → pyptt-1.2.13}/PyPtt/_api_get_board_info.py +0 -0
- {pyptt-1.2.11 → pyptt-1.2.13}/PyPtt/_api_get_board_list.py +0 -0
- {pyptt-1.2.11 → pyptt-1.2.13}/PyPtt/_api_get_bottom_post_list.py +0 -0
- {pyptt-1.2.11 → pyptt-1.2.13}/PyPtt/_api_get_favourite_board.py +0 -0
- {pyptt-1.2.11 → pyptt-1.2.13}/PyPtt/_api_get_newest_index.py +0 -0
- {pyptt-1.2.11 → pyptt-1.2.13}/PyPtt/_api_get_post.py +0 -0
- {pyptt-1.2.11 → pyptt-1.2.13}/PyPtt/_api_get_post_index.py +0 -0
- {pyptt-1.2.11 → pyptt-1.2.13}/PyPtt/_api_get_time.py +0 -0
- {pyptt-1.2.11 → pyptt-1.2.13}/PyPtt/_api_get_user.py +0 -0
- {pyptt-1.2.11 → pyptt-1.2.13}/PyPtt/_api_give_money.py +0 -0
- {pyptt-1.2.11 → pyptt-1.2.13}/PyPtt/_api_has_new_mail.py +0 -0
- {pyptt-1.2.11 → pyptt-1.2.13}/PyPtt/_api_loginout.py +0 -0
- {pyptt-1.2.11 → pyptt-1.2.13}/PyPtt/_api_mail.py +0 -0
- {pyptt-1.2.11 → pyptt-1.2.13}/PyPtt/_api_mark_post.py +0 -0
- {pyptt-1.2.11 → pyptt-1.2.13}/PyPtt/_api_post.py +0 -0
- {pyptt-1.2.11 → pyptt-1.2.13}/PyPtt/_api_reply_post.py +0 -0
- {pyptt-1.2.11 → pyptt-1.2.13}/PyPtt/_api_search_user.py +0 -0
- {pyptt-1.2.11 → pyptt-1.2.13}/PyPtt/_api_set_board_title.py +0 -0
- {pyptt-1.2.11 → pyptt-1.2.13}/PyPtt/_api_util.py +0 -0
- {pyptt-1.2.11 → pyptt-1.2.13}/PyPtt/check_value.py +0 -0
- {pyptt-1.2.11 → pyptt-1.2.13}/PyPtt/command.py +0 -0
- {pyptt-1.2.11 → pyptt-1.2.13}/PyPtt/config.py +0 -0
- {pyptt-1.2.11 → pyptt-1.2.13}/PyPtt/data_type.py +0 -0
- {pyptt-1.2.11 → pyptt-1.2.13}/PyPtt/exceptions.py +0 -0
- {pyptt-1.2.11 → pyptt-1.2.13}/PyPtt/lang_en_US.py +0 -0
- {pyptt-1.2.11 → pyptt-1.2.13}/PyPtt/lang_zh_TW.py +0 -0
- {pyptt-1.2.11 → pyptt-1.2.13}/PyPtt/lib_util.py +0 -0
- {pyptt-1.2.11 → pyptt-1.2.13}/PyPtt/log.py +0 -0
- {pyptt-1.2.11 → pyptt-1.2.13}/PyPtt/screens.py +0 -0
- {pyptt-1.2.11 → pyptt-1.2.13}/PyPtt/service.py +0 -0
- {pyptt-1.2.11 → pyptt-1.2.13}/PyPtt.egg-info/SOURCES.txt +0 -0
- {pyptt-1.2.11 → pyptt-1.2.13}/PyPtt.egg-info/dependency_links.txt +0 -0
- {pyptt-1.2.11 → pyptt-1.2.13}/PyPtt.egg-info/requires.txt +0 -0
- {pyptt-1.2.11 → pyptt-1.2.13}/PyPtt.egg-info/top_level.txt +0 -0
- {pyptt-1.2.11 → pyptt-1.2.13}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PyPtt
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.13
|
|
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">
|
|
@@ -13,7 +13,6 @@ from typing import Any
|
|
|
13
13
|
|
|
14
14
|
import websockets
|
|
15
15
|
import websockets.exceptions
|
|
16
|
-
import websockets.http
|
|
17
16
|
|
|
18
17
|
import PyPtt
|
|
19
18
|
from . import command
|
|
@@ -24,12 +23,20 @@ from . import log
|
|
|
24
23
|
from . import screens
|
|
25
24
|
from . import ssl_config
|
|
26
25
|
|
|
27
|
-
|
|
26
|
+
try:
|
|
27
|
+
import websockets.http
|
|
28
|
+
websockets.http.USER_AGENT += f' PyPtt/{PyPtt.__version__}'
|
|
29
|
+
use_http11 = False
|
|
30
|
+
except AttributeError:
|
|
31
|
+
import websockets.http11
|
|
32
|
+
websockets.http11.USER_AGENT += f' PyPtt/{PyPtt.__version__}'
|
|
33
|
+
use_http11 = True
|
|
28
34
|
|
|
29
|
-
ssl_context =
|
|
35
|
+
ssl_context = None
|
|
30
36
|
|
|
31
37
|
|
|
32
38
|
def ssl_init():
|
|
39
|
+
global ssl_context
|
|
33
40
|
|
|
34
41
|
cert_file = tempfile.NamedTemporaryFile(delete=False, suffix='.pem')
|
|
35
42
|
cert_file.write(ssl_config.cert.encode('utf-8'))
|
|
@@ -40,14 +47,17 @@ def ssl_init():
|
|
|
40
47
|
cert_file.close()
|
|
41
48
|
key_file.close()
|
|
42
49
|
|
|
50
|
+
ssl_context = ssl.create_default_context()
|
|
51
|
+
ssl_context.check_hostname = False
|
|
43
52
|
ssl_context.load_cert_chain(certfile=cert_file.name, keyfile=key_file.name)
|
|
53
|
+
ssl_context.minimum_version = ssl.TLSVersion.TLSv1_2
|
|
54
|
+
ssl_context.verify_mode = ssl.CERT_NONE
|
|
44
55
|
|
|
45
56
|
os.unlink(cert_file.name)
|
|
46
57
|
os.unlink(key_file.name)
|
|
47
58
|
|
|
48
59
|
|
|
49
60
|
ssl_init()
|
|
50
|
-
ssl_context.minimum_version = ssl.TLSVersion.TLSv1_2
|
|
51
61
|
|
|
52
62
|
|
|
53
63
|
class TargetUnit:
|
|
@@ -199,7 +209,7 @@ class API(object):
|
|
|
199
209
|
loop = asyncio.new_event_loop()
|
|
200
210
|
asyncio.set_event_loop(loop)
|
|
201
211
|
|
|
202
|
-
log.logger.debug('USER_AGENT', websockets.http.USER_AGENT)
|
|
212
|
+
log.logger.debug('USER_AGENT', websockets.http11.USER_AGENT if use_http11 else websockets.http.USER_AGENT)
|
|
203
213
|
self._core = asyncio.get_event_loop().run_until_complete(
|
|
204
214
|
websockets.connect(
|
|
205
215
|
websocket_host,
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
key = """-----BEGIN EC PARAMETERS-----
|
|
2
|
+
BggqhkjOPQMBBw==
|
|
3
|
+
-----END EC PARAMETERS-----
|
|
4
|
+
-----BEGIN EC PRIVATE KEY-----
|
|
5
|
+
MHcCAQEEIPlyCHd9g7xUfCSjEZiEVuQzYHTwHyQS1ph6IJeuWp0loAoGCCqGSM49
|
|
6
|
+
AwEHoUQDQgAEbzihcA0pY7m4q5+x+5MEka1HNMOzYuotBRKZsuNbIAhQttVpSH59
|
|
7
|
+
WOEQ8otbmNwApn97Rzo8Wc2Hwd1Couc7nA==
|
|
8
|
+
-----END EC PRIVATE KEY-----
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
cert = """-----BEGIN CERTIFICATE-----
|
|
12
|
+
MIIB6DCCAY8CFAqUEaN/XA35JcqUvcOv6ACavBaaMAoGCCqGSM49BAMCMHcxCzAJ
|
|
13
|
+
BgNVBAYTAlRXMQ4wDAYDVQQIDAVTdGF0ZTENMAsGA1UEBwwEQ2l0eTEVMBMGA1UE
|
|
14
|
+
CgwMT3JnYW5pemF0aW9uMRwwGgYDVQQLDBNPcmdhbml6YXRpb25hbCBVbml0MRQw
|
|
15
|
+
EgYDVQQDDAtDb21tb24gTmFtZTAeFw0yNDA5MDkwMzExMTBaFw0zNDA5MDcwMzEx
|
|
16
|
+
MTBaMHcxCzAJBgNVBAYTAlRXMQ4wDAYDVQQIDAVTdGF0ZTENMAsGA1UEBwwEQ2l0
|
|
17
|
+
eTEVMBMGA1UECgwMT3JnYW5pemF0aW9uMRwwGgYDVQQLDBNPcmdhbml6YXRpb25h
|
|
18
|
+
bCBVbml0MRQwEgYDVQQDDAtDb21tb24gTmFtZTBZMBMGByqGSM49AgEGCCqGSM49
|
|
19
|
+
AwEHA0IABG84oXANKWO5uKufsfuTBJGtRzTDs2LqLQUSmbLjWyAIULbVaUh+fVjh
|
|
20
|
+
EPKLW5jcAKZ/e0c6PFnNh8HdQqLnO5wwCgYIKoZIzj0EAwIDRwAwRAIgTW8rYznR
|
|
21
|
+
C0HtopDFIDXfYsAosEaVbFNYgUAFhEJb85ACIC+Tt5Q6HldwlzxeiTjqLJgiJcQX
|
|
22
|
+
Gn7eTXHDpDm24QA4
|
|
23
|
+
-----END CERTIFICATE-----
|
|
24
|
+
"""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PyPtt
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.13
|
|
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">
|
|
@@ -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
|
|
@@ -7,7 +7,9 @@ from setuptools import setup
|
|
|
7
7
|
|
|
8
8
|
def version_automation_script():
|
|
9
9
|
is_merged = os.environ.get('GITHUB_EVENT_NAME') == 'pull_request'
|
|
10
|
+
branch = os.environ.get('GITHUB_REF_NAME')
|
|
10
11
|
print('is_merged:', is_merged)
|
|
12
|
+
print('branch:', branch)
|
|
11
13
|
|
|
12
14
|
# read the main version from __init__.py
|
|
13
15
|
with open('PyPtt/__init__.py', 'r', encoding='utf-8') as f:
|
|
@@ -37,7 +39,7 @@ def version_automation_script():
|
|
|
37
39
|
if version is None or pypi_version is None:
|
|
38
40
|
raise ValueError('Can not get version from pypi')
|
|
39
41
|
|
|
40
|
-
if not
|
|
42
|
+
if 'master' not in branch:
|
|
41
43
|
commit_file = '/tmp/commit_hash.txt'
|
|
42
44
|
if os.path.exists(commit_file):
|
|
43
45
|
with open(commit_file, 'r', encoding='utf-8') as f:
|
pyptt-1.2.11/PyPtt/ssl_config.py
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
key = """-----BEGIN EC PARAMETERS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1pWVLJ8+ut4gMAoGCCqGSM49BAMCA0kAMEYCIQCTAENmnDhhG9ECHh7M
|
|
22
|
-
sY8qH+kA4fH6yDNwOIaozhmXuQIhAO5HR40oCn2+uKKM8HapRa9OUj12vmSTuLpO
|
|
23
|
-
UnFFlYXg
|
|
24
|
-
-----END CERTIFICATE-----
|
|
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
|