mcp-query-table 0.3.8__py3-none-any.whl → 0.3.9__py3-none-any.whl

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.
@@ -17,7 +17,7 @@ def main():
17
17
  parser.add_argument("--executable_path", type=str, help="浏览器路径",
18
18
  nargs="?", default=r'C:\Program Files\Google\Chrome\Application\chrome.exe')
19
19
  parser.add_argument("--user_data_dir", type=str, help="浏览器用户数据目录",
20
- nargs="?", default=rf'C:\Users\{getpass.getuser()}\AppData\Local\Google\Chrome\User Data')
20
+ nargs="?", default=rf'C:\Users\{getpass.getuser()}\AppData\Local\Google\Chrome\User Data\Default')
21
21
  parser.add_argument("--transport", type=str, help="传输类型",
22
22
  default='stdio', choices=['stdio', 'sse'])
23
23
  parser.add_argument("--host", type=str, help="MCP服务端绑定地址",
@@ -1 +1 @@
1
- __version__ = "0.3.8"
1
+ __version__ = "0.3.9"
@@ -10,10 +10,8 @@ import re
10
10
  import pandas as pd
11
11
  from loguru import logger
12
12
  from playwright.async_api import Page
13
- from playwright_stealth import stealth_async
14
13
 
15
14
  from mcp_query_table.enums import QueryType
16
- from mcp_query_table.utils import FixedConfig
17
15
 
18
16
  # 初次查询页面
19
17
  _PAGE1_ = 'https://www.iwencai.com/customized/chart/get-robot-data'
@@ -154,8 +152,6 @@ async def query(page: Page,
154
152
  querytype = _querytype_.get(type_, None)
155
153
  assert querytype is not None, f"不支持的类型:{type_}"
156
154
 
157
- await stealth_async(page, FixedConfig())
158
-
159
155
  await page.route(re.compile(r'.*\.(?:jpg|jpeg|png|gif|webp)(?:$|\?)'), lambda route: route.abort())
160
156
 
161
157
  P.reset()
mcp_query_table/tool.py CHANGED
@@ -4,11 +4,12 @@ import sys
4
4
  import time
5
5
  from pathlib import Path
6
6
  from typing import Optional
7
- from urllib.parse import urlparse
7
+ from urllib.parse import urlparse, quote
8
8
 
9
9
  import pandas as pd
10
10
  from loguru import logger
11
11
  from playwright.async_api import async_playwright, Playwright, Page
12
+ from playwright_stealth import Stealth
12
13
 
13
14
  from mcp_query_table.enums import QueryType, Site, Provider
14
15
 
@@ -204,6 +205,8 @@ class BrowserManager:
204
205
  self.context = await self.browser.new_context()
205
206
  else:
206
207
  self.context = self.browser.contexts[0]
208
+ # 爱问财,无头模式,需要使用 stealth 插件
209
+ await Stealth().apply_stealth_async(self.context)
207
210
 
208
211
  # 复用打开的page
209
212
  for page in self.context.pages:
@@ -268,6 +271,7 @@ async def query(
268
271
  查询结果
269
272
 
270
273
  """
274
+ query_input = quote(query_input.strip(), safe='')
271
275
 
272
276
  if site == Site.EastMoney:
273
277
  from mcp_query_table.sites.eastmoney import query
mcp_query_table/utils.py CHANGED
@@ -1,10 +1,6 @@
1
- import random
2
- import string
3
1
  from pathlib import Path
4
2
  from typing import List, Tuple
5
3
 
6
- from playwright_stealth import StealthConfig
7
-
8
4
 
9
5
  def is_image(path: str) -> bool:
10
6
  """判断是否是图片文件"""
@@ -36,16 +32,3 @@ class GlobalVars:
36
32
 
37
33
  def get_text(self):
38
34
  return self.text
39
-
40
-
41
- # https://github.com/AtuboDad/playwright_stealth/issues/31#issuecomment-2342541305
42
- class FixedConfig(StealthConfig):
43
-
44
- @property
45
- def enabled_scripts(self):
46
- key = "".join(random.choices(string.ascii_letters, k=10))
47
- for script in super().enabled_scripts:
48
- if "const opts" in script:
49
- yield script.replace("const opts", f"window.{key}")
50
- continue
51
- yield script.replace("opts", f"window.{key}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mcp_query_table
3
- Version: 0.3.8
3
+ Version: 0.3.9
4
4
  Summary: query table from website, support MCP
5
5
  Author-email: wukan <wu-kan@163.com>
6
6
  License: MIT License
@@ -33,8 +33,7 @@ Requires-Dist: loguru
33
33
  Requires-Dist: mcp
34
34
  Requires-Dist: pandas
35
35
  Requires-Dist: playwright
36
- Requires-Dist: playwright-stealth
37
- Requires-Dist: setuptools
36
+ Requires-Dist: playwright-stealth>=2.0.0
38
37
  Requires-Dist: tabulate
39
38
  Description-Content-Type: text/markdown
40
39
 
@@ -1,19 +1,19 @@
1
1
  mcp_query_table/__init__.py,sha256=K-0DU2hpeRvM9ZAuky0aWZtJLuOgKg7ZRd-pL9noc0o,330
2
- mcp_query_table/__main__.py,sha256=oePptyDeLtOHcR0XZxx-O12hO6LSe6cplb4gaJBG4rI,1453
3
- mcp_query_table/_version.py,sha256=7dTW0A5-FkrEuNOotvR8oW59M2lvIwYouVqfJzvXpKk,22
2
+ mcp_query_table/__main__.py,sha256=K0r7y8PD9y9pFg3bAQxNo21KlQpGz1jqGg_zptPfenM,1461
3
+ mcp_query_table/_version.py,sha256=xmkmdvq15kb61xdtCoa1YARnvHBnUgI-0GWIJYvHNeA,22
4
4
  mcp_query_table/enums.py,sha256=7bu0m0zJBIfiS-eHGURw1ZHWNXgsq6gH1SztUhCgF-Y,678
5
5
  mcp_query_table/server.py,sha256=D2-7ZmutijphasbLMosg9P5EOhJTB4RvC9-zmvCvc5k,3749
6
- mcp_query_table/tool.py,sha256=PpsDFwaKQ9NsfqSMCvWm1p0MSyxT1Uwpve198TOP8FQ,11157
7
- mcp_query_table/utils.py,sha256=VjKYLRPEa-W3qAOaNSJa9GnezrAAYykn4XY-R4P5NJg,1264
6
+ mcp_query_table/tool.py,sha256=dW6Hcv7aB-hBotd7OBzCWQrpRck1h5812y6sRCUENVA,11380
7
+ mcp_query_table/utils.py,sha256=MUKcklPF9TkABhM8wN0-kW0iy9AlmjL6oycZyxB_Qk8,722
8
8
  mcp_query_table/providers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  mcp_query_table/providers/baidu.py,sha256=S75D2zbpqG1r4Rxz7pJf5u2ZHNLO8nqV-LPEjlACtHg,3390
10
10
  mcp_query_table/providers/n.py,sha256=SLalpwHSdkXNoMCLQEx1TEFlo50dS7I9JNli5jz8w6k,3202
11
11
  mcp_query_table/providers/yuanbao.py,sha256=1wRMy7Z2JraM3MrgLDSdyg-EqX-D26ysx7CW1GFtVho,3292
12
12
  mcp_query_table/sites/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
13
  mcp_query_table/sites/eastmoney.py,sha256=LImjpYVuM5YnXwnNzB2hkKfHofocZZScetGqMOCHZpk,4477
14
- mcp_query_table/sites/iwencai.py,sha256=43sBrVCXgiIybv25lEwTS6dlR2jXXceSBVGCOb03woE,5194
14
+ mcp_query_table/sites/iwencai.py,sha256=FlIQOAN6wPz0B8w5DFX-EHekPO5HPIYdLMhiX1dYV7s,5057
15
15
  mcp_query_table/sites/tdx.py,sha256=P-GNFUsS5_INy3sicaZbUBdudgQBZuhu_QyVvyw4yDg,4126
16
- mcp_query_table-0.3.8.dist-info/METADATA,sha256=4nnj_OrLYG0SMPlvSn9TpNI5IOx1DNsTfsWt22sVdqs,9372
17
- mcp_query_table-0.3.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
18
- mcp_query_table-0.3.8.dist-info/licenses/LICENSE,sha256=rbvv_CTd7biGwT21tvhgQ2zkbPFXOoON7WFQWEdElBA,1063
19
- mcp_query_table-0.3.8.dist-info/RECORD,,
16
+ mcp_query_table-0.3.9.dist-info/METADATA,sha256=w6Kk_cokNDdnTgr7APF6IhlSVOHJTrDAO0uGdhTaNvA,9353
17
+ mcp_query_table-0.3.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
18
+ mcp_query_table-0.3.9.dist-info/licenses/LICENSE,sha256=rbvv_CTd7biGwT21tvhgQ2zkbPFXOoON7WFQWEdElBA,1063
19
+ mcp_query_table-0.3.9.dist-info/RECORD,,