pyscriptbase 1.1.2__tar.gz → 1.1.5__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 (22) hide show
  1. {pyscriptbase-1.1.2 → pyscriptbase-1.1.5}/PKG-INFO +2 -7
  2. {pyscriptbase-1.1.2 → pyscriptbase-1.1.5}/pyscriptbase/net.py +0 -1
  3. {pyscriptbase-1.1.2 → pyscriptbase-1.1.5}/pyscriptbase/pusher.py +8 -0
  4. {pyscriptbase-1.1.2 → pyscriptbase-1.1.5}/pyscriptbase/script.py +4 -2
  5. pyscriptbase-1.1.5/pyscriptbase/sms.py +208 -0
  6. {pyscriptbase-1.1.2 → pyscriptbase-1.1.5}/pyscriptbase.egg-info/PKG-INFO +2 -7
  7. {pyscriptbase-1.1.2 → pyscriptbase-1.1.5}/pyscriptbase.egg-info/SOURCES.txt +1 -0
  8. {pyscriptbase-1.1.2 → pyscriptbase-1.1.5}/setup.py +2 -2
  9. {pyscriptbase-1.1.2 → pyscriptbase-1.1.5}/README.md +0 -0
  10. {pyscriptbase-1.1.2 → pyscriptbase-1.1.5}/pyscriptbase/__init__.py +0 -0
  11. {pyscriptbase-1.1.2 → pyscriptbase-1.1.5}/pyscriptbase/app.py +0 -0
  12. {pyscriptbase-1.1.2 → pyscriptbase-1.1.5}/pyscriptbase/cipher.py +0 -0
  13. {pyscriptbase-1.1.2 → pyscriptbase-1.1.5}/pyscriptbase/database.py +0 -0
  14. {pyscriptbase-1.1.2 → pyscriptbase-1.1.5}/pyscriptbase/env.py +0 -0
  15. {pyscriptbase-1.1.2 → pyscriptbase-1.1.5}/pyscriptbase/panel.py +0 -0
  16. {pyscriptbase-1.1.2 → pyscriptbase-1.1.5}/pyscriptbase/util.py +0 -0
  17. {pyscriptbase-1.1.2 → pyscriptbase-1.1.5}/pyscriptbase/webview.py +0 -0
  18. {pyscriptbase-1.1.2 → pyscriptbase-1.1.5}/pyscriptbase.egg-info/dependency_links.txt +0 -0
  19. {pyscriptbase-1.1.2 → pyscriptbase-1.1.5}/pyscriptbase.egg-info/requires.txt +0 -0
  20. {pyscriptbase-1.1.2 → pyscriptbase-1.1.5}/pyscriptbase.egg-info/top_level.txt +0 -0
  21. {pyscriptbase-1.1.2 → pyscriptbase-1.1.5}/setup.cfg +0 -0
  22. {pyscriptbase-1.1.2 → pyscriptbase-1.1.5}/test/test.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.1
2
2
  Name: pyscriptbase
3
- Version: 1.1.2
3
+ Version: 1.1.5
4
4
  Summary: python script base library
5
5
  Home-page:
6
6
  Author: ASMan
@@ -19,11 +19,6 @@ Requires-Dist: beautifulsoup4
19
19
  Requires-Dist: requests
20
20
  Requires-Dist: lxml
21
21
  Requires-Dist: brotli
22
- Dynamic: author
23
- Dynamic: description
24
- Dynamic: description-content-type
25
- Dynamic: requires-dist
26
- Dynamic: summary
27
22
 
28
23
  # Instructions
29
24
 
@@ -385,7 +385,6 @@ class CloudRequest:
385
385
  params=params,
386
386
  )
387
387
 
388
-
389
388
  def __req__(
390
389
  self,
391
390
  method: str,
@@ -213,3 +213,11 @@ def sendMail(
213
213
  server.sendmail(sender, receiver, message.as_string()) # 发送邮件
214
214
  except Exception as e:
215
215
  print(f"Error: unable to send email. {e}")
216
+
217
+
218
+ def sendMailWithHtmlTable(
219
+ table: HtmlTableEmail,
220
+ receiver: str = None,
221
+ params: SMTPParams = None,
222
+ ):
223
+ sendMail(table.title, table, receiver, params)
@@ -12,9 +12,9 @@ class ScriptApp:
12
12
  def __init__(
13
13
  self,
14
14
  index: int = 1,
15
+ debug: bool = False,
15
16
  useProxy: bool = True,
16
17
  randomProxy: bool = False,
17
- debug: bool = False,
18
18
  useCloud: bool = True,
19
19
  randomCloud: bool = False,
20
20
  ) -> None:
@@ -95,7 +95,9 @@ class ScriptApp:
95
95
  if self.randomCloud:
96
96
  self.cloudNet.cloud = random.choice(ScriptApp._cloudProxies)
97
97
  else:
98
- self.cloudNet.cloud = ScriptApp._cloudProxies[index % len(ScriptApp._cloudProxies)]
98
+ self.cloudNet.cloud = ScriptApp._cloudProxies[
99
+ index % len(ScriptApp._cloudProxies)
100
+ ]
99
101
 
100
102
  def __log__(self, msg: str | dict = "", flush: bool = False):
101
103
  if flush or self.debug:
@@ -0,0 +1,208 @@
1
+ import re
2
+ from urllib.parse import urlencode
3
+ import requests
4
+
5
+
6
+ class FeiyunApp:
7
+ def __init__(
8
+ self,
9
+ username: str,
10
+ password: str,
11
+ proxy: str = None,
12
+ host: str = "https://h5.fysms.cc",
13
+ ) -> None:
14
+ self.isLogin = False
15
+ self.money = 0
16
+ self.point = 0
17
+ self.cookies = ""
18
+ self.host = host
19
+ self.username = username
20
+ self.password = password
21
+ if proxy:
22
+ self.proxies = {
23
+ "http": proxy,
24
+ "https": proxy,
25
+ }
26
+ else:
27
+ self.proxies = None
28
+ self.login()
29
+
30
+ def login(self):
31
+ url = f"{self.host}/index.php?m=user&c=Users&a=login"
32
+ headers = {
33
+ "Sec-Ch-UA": '"Not/A)Brand";v="8", "Chromium";v="126", "Google Chrome";v="126"',
34
+ "Sec-Ch-UA-Mobile": "?0",
35
+ "Sec-Ch-UA-Platform": '"Windows"',
36
+ "Upgrade-Insecure-Requests": "1",
37
+ "Sec-Fetch-Site": "none",
38
+ "Sec-Fetch-Mode": "navigate",
39
+ "Sec-Fetch-User": "?1",
40
+ "Sec-Fetch-Dest": "document",
41
+ "Accept-Language": "zh-CN,zh;q=0.9",
42
+ "Priority": "u=0, i",
43
+ "Origin": f"{self.host}",
44
+ "Referer": f"{self.host}/index.php?m=user&c=Users&a=reg",
45
+ "Accept": "text/html,application/xhtml+xml,application/xml;",
46
+ "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
47
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36",
48
+ }
49
+ cDict = requests.get(
50
+ url=url, headers=headers, proxies=self.proxies, verify=False
51
+ ).cookies.get_dict()
52
+ cookies = ""
53
+ for key, value in cDict.items():
54
+ cookies += key + "=" + value + "; "
55
+
56
+ url = f"{self.host}/index.php?m=user&c=Users&a=login"
57
+ body = f"username={self.username}&password={self.password}&referurl=%2Findex.php%3Fm%3Duser%26c%3DUsers%26a%3Dcentre&website=website"
58
+ headers = {
59
+ "Sec-Ch-UA": '"Not/A)Brand";v="8", "Chromium";v="126", "Google Chrome";v="126"',
60
+ "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
61
+ "X-Requested-With": "XMLHttpRequest",
62
+ "Sec-Ch-UA-Mobile": "?0",
63
+ "Sec-Ch-UA-Platform": '"Windows"',
64
+ "Origin": f"{self.host}",
65
+ "Sec-Fetch-Site": "same-origin",
66
+ "Sec-Fetch-Mode": "cors",
67
+ "Sec-Fetch-Dest": "empty",
68
+ "Referer": f"{self.host}/index.php?m=user&c=Users&a=login",
69
+ "Accept-Language": "zh-CN,zh;q=0.9",
70
+ "Cookie": cookies,
71
+ "Priority": "u=1, i",
72
+ }
73
+ cDict = requests.post(
74
+ url, data=body, headers=headers, proxies=self.proxies, verify=False
75
+ ).cookies.get_dict()
76
+ if "users_id" in cDict:
77
+ cookies += "users_id=" + cDict["users_id"] + "; "
78
+ self.cookies = cookies
79
+ self.isLogin = True
80
+ self.uid = cDict["users_id"]
81
+ else:
82
+ self.__log__("登录失败")
83
+ self.isLogin = False
84
+
85
+ def getPhone(self) -> str | None:
86
+ """
87
+ 获取手机号
88
+ :return: 手机号 | invalid(不可用) | None(获取失败)
89
+ """
90
+ headers = {
91
+ "Sec-Ch-UA": '"Not/A)Brand";v="8", "Chromium";v="126", "Google Chrome";v="126"',
92
+ "Sec-Ch-UA-Mobile": "?0",
93
+ "Sec-Ch-UA-Platform": '"Windows"',
94
+ "Origin": f"{self.host}",
95
+ "Sec-Fetch-Site": "same-origin",
96
+ "Sec-Fetch-Mode": "cors",
97
+ "Sec-Fetch-Dest": "empty",
98
+ "Referer": f"{self.host}/",
99
+ "Accept-Language": "zh-CN,zh;q=0.9",
100
+ "Cookie": self.cookies,
101
+ "Priority": "u=1, i",
102
+ "x-requested-with": "XMLHttpRequest",
103
+ }
104
+
105
+ # url = f"{self.host}/index.php?m=home&c=Index&a=selectrmb_21&proid=wasd%5D1.5&xuanze=0&userid={self.uid}"
106
+ # text = self.net.get(url=url, headers=headers, isJson=False, timeout=60)
107
+ # if text:
108
+ # text = text.lstrip("\ufeff").strip('"')
109
+ # if text != "1":
110
+ # print(f"获取手机号失败: 预检 {text}")
111
+ # return None
112
+
113
+ if not self.isLogin:
114
+ return "invalid"
115
+
116
+ url = f"{self.host}/index.php?m=home&c=Index&a=getxksjh"
117
+ text = requests.get(
118
+ url=url, headers=headers, proxies=self.proxies, verify=False
119
+ ).text
120
+ if text:
121
+ text = text.lstrip("\ufeff").strip('"')
122
+ if text and text.isdigit():
123
+ print(f"获取手机号成功:{text}")
124
+ return text
125
+ elif text == "buzu":
126
+ print(f"账号余额不足: {text}")
127
+ return "invalid"
128
+ else:
129
+ print(f"获取手机号失败: {text}")
130
+ return None
131
+
132
+ def getCode(self, phone: str, project: str) -> str | None:
133
+ """
134
+ 获取验证码
135
+ :param phone: 手机号
136
+ :param project: 项目
137
+ :return: 验证码 | invalid(不可用) | None(获取失败)
138
+ """
139
+ if not self.isLogin:
140
+ return "invalid"
141
+
142
+ params = urlencode(
143
+ {
144
+ "gjz": project,
145
+ "m": "home",
146
+ "c": "Index",
147
+ "a": "selectrmb",
148
+ "userid": self.uid,
149
+ "phone": phone,
150
+ "zuoyong": "11",
151
+ "yzuid": int(self.uid) * 2 - 5,
152
+ }
153
+ )
154
+ url = f"{self.host}/index.php?{params}"
155
+ headers = {
156
+ "Sec-Ch-UA": '"Not/A)Brand";v="8", "Chromium";v="126", "Google Chrome";v="126"',
157
+ "Sec-Ch-UA-Mobile": "?0",
158
+ "Sec-Ch-UA-Platform": '"Windows"',
159
+ "Origin": f"{self.host}",
160
+ "Sec-Fetch-Site": "same-origin",
161
+ "Sec-Fetch-Mode": "cors",
162
+ "Sec-Fetch-Dest": "empty",
163
+ "Referer": f"{self.host}/",
164
+ "Accept-Language": "zh-CN,zh;q=0.9",
165
+ "Cookie": self.cookies,
166
+ "Priority": "u=1, i",
167
+ "x-requested-with": "XMLHttpRequest",
168
+ }
169
+ text = requests.get(
170
+ url=url, headers=headers, proxies=self.proxies, verify=False
171
+ ).text
172
+ if text:
173
+ text = text.lstrip("\ufeff").strip('"')
174
+ if text == "1":
175
+ print("未获取到验证码")
176
+ return None
177
+ elif text == "buzu":
178
+ print(f"账号余额不足: {text}")
179
+ return "invalid"
180
+ elif text and text.find(project) > -1:
181
+ codes = self.extract_verification_codes(text)
182
+ if codes:
183
+ print(f"获取验证码成功:{codes[0]}")
184
+ return codes[0]
185
+ else:
186
+ print(f"提取验证码失败: {text}")
187
+ return None
188
+ else:
189
+ print(f"获取验证码失败: {text}")
190
+ return None
191
+
192
+ def extract_verification_codes(self, text):
193
+ """
194
+ 从文本中提取所有独立的 4 位、5 位或 6 位数字验证码。
195
+
196
+ 参数:
197
+ text (str): 输入的文本字符串
198
+
199
+ 返回:
200
+ list: 包含所有匹配到的验证码列表
201
+ """
202
+ # 正则表达式解释:
203
+ # \b : 单词边界,确保数字前后不是其他数字或字母(防止匹配长数字的一部分)
204
+ # (\d{4}|\d{5}|\d{6}) : 匹配恰好 4 位、5 位或 6 位的数字
205
+ pattern = r"\b(\d{4}|\d{5}|\d{6})\b"
206
+
207
+ matches = re.findall(pattern, text)
208
+ return matches
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.1
2
2
  Name: pyscriptbase
3
- Version: 1.1.2
3
+ Version: 1.1.5
4
4
  Summary: python script base library
5
5
  Home-page:
6
6
  Author: ASMan
@@ -19,11 +19,6 @@ Requires-Dist: beautifulsoup4
19
19
  Requires-Dist: requests
20
20
  Requires-Dist: lxml
21
21
  Requires-Dist: brotli
22
- Dynamic: author
23
- Dynamic: description
24
- Dynamic: description-content-type
25
- Dynamic: requires-dist
26
- Dynamic: summary
27
22
 
28
23
  # Instructions
29
24
 
@@ -9,6 +9,7 @@ pyscriptbase/net.py
9
9
  pyscriptbase/panel.py
10
10
  pyscriptbase/pusher.py
11
11
  pyscriptbase/script.py
12
+ pyscriptbase/sms.py
12
13
  pyscriptbase/util.py
13
14
  pyscriptbase/webview.py
14
15
  pyscriptbase.egg-info/PKG-INFO
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="pyscriptbase", # 包名
5
- version="1.1.2", # 版本号
5
+ version="1.1.5", # 版本号
6
6
  packages=find_packages(), # 自动查找包
7
7
  author="ASMan",
8
8
  author_email="",
@@ -23,6 +23,6 @@ setup(
23
23
  "beautifulsoup4",
24
24
  "requests",
25
25
  "lxml",
26
- "brotli"
26
+ "brotli",
27
27
  ], # 依赖包列表
28
28
  )
File without changes
File without changes
File without changes