cnhkmcp 1.4.2__py3-none-any.whl → 1.4.4__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.
- cnhkmcp/__init__.py +1 -1
- cnhkmcp/untracked/mcp/321/206/320/246/320/227/321/204/342/225/227/342/225/242/321/210/320/276/342/225/221/321/205/320/255/320/253/321/207/320/231/320/2302_/321/205/320/266/320/222/321/206/320/256/320/254/321/205/320/236/320/257/321/207/320/231/320/230/321/207/320/251/342/225/227/321/205/342/225/234/320/245/321/204/342/225/225/320/235/321/204/342/225/225/320/232/321/210/320/276/342/225/221/321/205/320/255/320/253/321/210/320/277/320/245/321/210/342/224/220/320/251/321/204/342/225/225/320/272/forum_functions.py +407 -0
- cnhkmcp/untracked/mcp/321/206/320/246/320/227/321/204/342/225/227/342/225/242/321/210/320/276/342/225/221/321/205/320/255/320/253/321/207/320/231/320/2302_/321/205/320/266/320/222/321/206/320/256/320/254/321/205/320/236/320/257/321/207/320/231/320/230/321/207/320/251/342/225/227/321/205/342/225/234/320/245/321/204/342/225/225/320/235/321/204/342/225/225/320/232/321/210/320/276/342/225/221/321/205/320/255/320/253/321/210/320/277/320/245/321/210/342/224/220/320/251/321/204/342/225/225/320/272/platform_functions.py +2415 -0
- cnhkmcp/untracked/mcp/321/206/320/246/320/227/321/204/342/225/227/342/225/242/321/210/320/276/342/225/221/321/205/320/255/320/253/321/207/320/231/320/2302_/321/205/320/266/320/222/321/206/320/256/320/254/321/205/320/236/320/257/321/207/320/231/320/230/321/207/320/251/342/225/227/321/205/342/225/234/320/245/321/204/342/225/225/320/235/321/204/342/225/225/320/232/321/210/320/276/342/225/221/321/205/320/255/320/253/321/210/320/277/320/245/321/210/342/224/220/320/251/321/204/342/225/225/320/272/playwright_setup_guide.md +93 -0
- cnhkmcp/untracked/mcp/321/206/320/246/320/227/321/204/342/225/227/342/225/242/321/210/320/276/342/225/221/321/205/320/255/320/253/321/207/320/231/320/2302_/321/205/320/266/320/222/321/206/320/256/320/254/321/205/320/236/320/257/321/207/320/231/320/230/321/207/320/251/342/225/227/321/205/342/225/234/320/245/321/204/342/225/225/320/235/321/204/342/225/225/320/232/321/210/320/276/342/225/221/321/205/320/255/320/253/321/210/320/277/320/245/321/210/342/224/220/320/251/321/204/342/225/225/320/272/user_config.json +31 -0
- cnhkmcp/untracked/platform_functions.py +11 -7
- {cnhkmcp-1.4.2.dist-info → cnhkmcp-1.4.4.dist-info}/METADATA +1 -1
- {cnhkmcp-1.4.2.dist-info → cnhkmcp-1.4.4.dist-info}/RECORD +12 -8
- {cnhkmcp-1.4.2.dist-info → cnhkmcp-1.4.4.dist-info}/WHEEL +0 -0
- {cnhkmcp-1.4.2.dist-info → cnhkmcp-1.4.4.dist-info}/entry_points.txt +0 -0
- {cnhkmcp-1.4.2.dist-info → cnhkmcp-1.4.4.dist-info}/licenses/LICENSE +0 -0
- {cnhkmcp-1.4.2.dist-info → cnhkmcp-1.4.4.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Guide: Setting Up Playwright with a Local Chrome Executable
|
|
2
|
+
|
|
3
|
+
This guide explains how to configure Playwright to use a locally extracted Google Chrome browser. This is useful in environments where you don't have `sudo` permissions to install Chrome or its dependencies system-wide.
|
|
4
|
+
|
|
5
|
+
## The Problem
|
|
6
|
+
|
|
7
|
+
When running a Playwright script, you might encounter an error like this:
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
playwright._impl._errors.Error: BrowserType.launch: Executable doesn't exist at ...
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
This means Playwright cannot find the Chrome browser executable in its default search paths.
|
|
14
|
+
|
|
15
|
+
## The Solution: Local Extraction
|
|
16
|
+
|
|
17
|
+
The solution is to download the Chrome `.deb` package, extract the executable, and then point your Playwright script to it.
|
|
18
|
+
|
|
19
|
+
### Step 1: Download the Chrome `.deb` Package
|
|
20
|
+
|
|
21
|
+
You can download the latest stable version of Google Chrome for Debian/Ubuntu-based systems using `wget`:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Step 2: Extract the Executable
|
|
28
|
+
|
|
29
|
+
Once you have the `.deb` file, you can extract its contents without installing it.
|
|
30
|
+
|
|
31
|
+
1. **Extract the `.deb` archive:** The `ar` command extracts the contents of the `.deb` file.
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
ar x google-chrome-stable_current_amd64.deb
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
This will create several files, including `data.tar.xz`.
|
|
38
|
+
|
|
39
|
+
2. **Extract the data archive:** The `data.tar.xz` file contains the actual program files.
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
tar -xf data.tar.xz
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
This will create an `opt` directory in your current location.
|
|
46
|
+
|
|
47
|
+
### Step 3: Locate the Chrome Executable
|
|
48
|
+
|
|
49
|
+
The Chrome executable is now located at `./opt/google/chrome/chrome`.
|
|
50
|
+
|
|
51
|
+
### Step 4: Configure Your Playwright Script
|
|
52
|
+
|
|
53
|
+
In your Python script forum_functions.py, you need to tell Playwright where to find the Chrome executable by using the `executable_path` argument when launching the browser.
|
|
54
|
+
|
|
55
|
+
It is best practice to use an **absolute path** to avoid issues with the script's working directory. You can construct the absolute path by combining your project's root directory with the relative path to the executable.
|
|
56
|
+
|
|
57
|
+
Here is an example:
|
|
58
|
+
|
|
59
|
+
```python
|
|
60
|
+
import os
|
|
61
|
+
from playwright.async_api import async_playwright
|
|
62
|
+
import asyncio
|
|
63
|
+
|
|
64
|
+
async def main():
|
|
65
|
+
# Get the absolute path to the executable
|
|
66
|
+
project_dir = os.getcwd() # Or specify your project's absolute path
|
|
67
|
+
executable_path = os.path.join(project_dir, 'opt/google/chrome/chrome')
|
|
68
|
+
|
|
69
|
+
async with async_playwright() as p:
|
|
70
|
+
browser = await p.chromium.launch(
|
|
71
|
+
executable_path=executable_path,
|
|
72
|
+
args=['--headless=new', '--no-sandbox']
|
|
73
|
+
)
|
|
74
|
+
page = await browser.new_page()
|
|
75
|
+
await page.goto('http://playwright.dev')
|
|
76
|
+
print(await page.title())
|
|
77
|
+
await browser.close()
|
|
78
|
+
|
|
79
|
+
if __name__ == '__main__':
|
|
80
|
+
asyncio.run(main())
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
By providing the absolute `executable_path`, you are explicitly telling Playwright where to find the browser, making your script more robust.
|
|
84
|
+
|
|
85
|
+
## Alternative: `playwright install`
|
|
86
|
+
|
|
87
|
+
If you have `sudo` permissions, the recommended way to install the browsers for Playwright is to use the following command:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
playwright install --with-deps
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
This will download the browser and also install all the necessary system dependencies.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"credentials": {
|
|
3
|
+
"email": "youremail@mai.com",
|
|
4
|
+
"password": "yourpassword"
|
|
5
|
+
},
|
|
6
|
+
"api_settings": {
|
|
7
|
+
"base_url": "https://api.worldquantbrain.com",
|
|
8
|
+
"timeout": 30,
|
|
9
|
+
"retry_attempts": 3
|
|
10
|
+
},
|
|
11
|
+
"forum_settings": {
|
|
12
|
+
"base_url": "https://support.worldquantbrain.com",
|
|
13
|
+
"headless": true,
|
|
14
|
+
"timeout": 30
|
|
15
|
+
},
|
|
16
|
+
"simulation_defaults": {
|
|
17
|
+
"type": "REGULAR",
|
|
18
|
+
"instrument_type": "EQUITY",
|
|
19
|
+
"region": "USA",
|
|
20
|
+
"universe": "TOP3000",
|
|
21
|
+
"delay": 1,
|
|
22
|
+
"decay": 0,
|
|
23
|
+
"neutralization": "NONE",
|
|
24
|
+
"truncation": 0,
|
|
25
|
+
"test_period": "P0Y0M",
|
|
26
|
+
"unit_handling": "NONE",
|
|
27
|
+
"nan_handling": "NONE",
|
|
28
|
+
"language": "FASTEXPR",
|
|
29
|
+
"visualization": true
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -2747,24 +2747,28 @@ async def get_daily_and_quarterly_payment(email: str = "", password: str = "") -
|
|
|
2747
2747
|
if not config.get('is_authenticated'):
|
|
2748
2748
|
return {"error": "Not authenticated. Please provide email and password or authenticate first."}
|
|
2749
2749
|
|
|
2750
|
+
|
|
2751
|
+
# Set required Accept header for API v3.0
|
|
2752
|
+
header = {"Accept": "application/json;version=3.0"}
|
|
2753
|
+
|
|
2750
2754
|
# Get base payment data
|
|
2751
2755
|
base_payment_response = brain_client.session.get(
|
|
2752
|
-
'https://api.worldquantbrain.com/users/self/activities/base-payment'
|
|
2756
|
+
'https://api.worldquantbrain.com/users/self/activities/base-payment', headers=header
|
|
2753
2757
|
)
|
|
2754
|
-
|
|
2758
|
+
|
|
2755
2759
|
if base_payment_response.status_code != 200:
|
|
2756
2760
|
return {"error": f"Failed to get base payment data: {base_payment_response.status_code}"}
|
|
2757
|
-
|
|
2761
|
+
|
|
2758
2762
|
base_payment_data = base_payment_response.json()
|
|
2759
|
-
|
|
2763
|
+
|
|
2760
2764
|
# Get other payment data
|
|
2761
2765
|
other_payment_response = brain_client.session.get(
|
|
2762
|
-
'https://api.worldquantbrain.com/users/self/activities/other-payment'
|
|
2766
|
+
'https://api.worldquantbrain.com/users/self/activities/other-payment', headers=header
|
|
2763
2767
|
)
|
|
2764
|
-
|
|
2768
|
+
|
|
2765
2769
|
if other_payment_response.status_code != 200:
|
|
2766
2770
|
return {"error": f"Failed to get other payment data: {other_payment_response.status_code}"}
|
|
2767
|
-
|
|
2771
|
+
|
|
2768
2772
|
other_payment_data = other_payment_response.json()
|
|
2769
2773
|
|
|
2770
2774
|
# Return comprehensive payment information
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
cnhkmcp/__init__.py,sha256=
|
|
1
|
+
cnhkmcp/__init__.py,sha256=g7VVJT0Kuw03GOd81xINdM_AtusXqJk-atFRMN1Uhj8,2758
|
|
2
2
|
cnhkmcp/untracked/arXiv_API_Tool_Manual.md,sha256=I3hvI5mpmIjBuWptufoVSWFnuhyUc67oCGHEuR0p_xs,13552
|
|
3
3
|
cnhkmcp/untracked/arxiv_api.py,sha256=-E-Ub9K-DXAYaCjrbobyfQ9H97gaZBc7pL6xPEyVHec,9020
|
|
4
4
|
cnhkmcp/untracked/forum_functions.py,sha256=QW-CplAsqDkw-Wcwq-1tuZBq48dEO-vXZ8xw7X65EuE,42303
|
|
5
|
-
cnhkmcp/untracked/platform_functions.py,sha256=
|
|
5
|
+
cnhkmcp/untracked/platform_functions.py,sha256=XSFCfeQnPV4tiJSAChPjr0P7iBidmDHUJo8J07D_5uc,119946
|
|
6
6
|
cnhkmcp/untracked/sample_mcp_config.json,sha256=QSFvZ086bxUQsvmLjcE6pL9ObzKn4FGnt9npWPo7Eps,1044
|
|
7
7
|
cnhkmcp/untracked/user_config.json,sha256=_INn1X1qIsITrmEno-BRlQOAGm9wnNCw-6B333DEvnk,695
|
|
8
8
|
cnhkmcp/untracked/示例参考文档_BRAIN_Alpha_Test_Requirements_and_Tips.md,sha256=W4dtQrqoTN72UyvIsvkGRF0HFOJLHSDeeSlbR3gqQg0,17133
|
|
@@ -60,9 +60,13 @@ cnhkmcp/untracked/APP/templates/inspiration_house.html,sha256=CZMHj_ild-mUDRvNc5
|
|
|
60
60
|
cnhkmcp/untracked/APP/templates/paper_analysis.html,sha256=7HgltBpZtmZCYCF7JU4wU9F5NMxUKyCXg7bCYCRfQDs,4139
|
|
61
61
|
cnhkmcp/untracked/APP/templates/simulator.html,sha256=Y3-w-mZyvRiOdBiFe705CqBPAUI07KNY2WJ5meNzHM8,12508
|
|
62
62
|
cnhkmcp/untracked/__pycache__/forum_functions.cpython-313.pyc,sha256=agARlP2x36scUU0TIYnrHB3EpEx4OOuHrB42_B1XR3k,45049
|
|
63
|
-
cnhkmcp
|
|
64
|
-
cnhkmcp
|
|
65
|
-
cnhkmcp
|
|
66
|
-
cnhkmcp
|
|
67
|
-
cnhkmcp-1.4.
|
|
68
|
-
cnhkmcp-1.4.
|
|
63
|
+
cnhkmcp/untracked/mcp文件论坛版2_如果原版登录不上论坛试这个/forum_functions.py,sha256=sm2Vqi7Dq0plbXNvMC2_Y0qOFAR3jBhQ4KDLJfMDH6s,19026
|
|
64
|
+
cnhkmcp/untracked/mcp文件论坛版2_如果原版登录不上论坛试这个/platform_functions.py,sha256=aa5jCRjCORFars8CVahqwbk5ni0mLYWu9yND7Z4TGUM,99159
|
|
65
|
+
cnhkmcp/untracked/mcp文件论坛版2_如果原版登录不上论坛试这个/playwright_setup_guide.md,sha256=AQsW5HNmuQ2XCl7bY1lVp1mCXuKOjoNtmLuXJyoS_oQ,3234
|
|
66
|
+
cnhkmcp/untracked/mcp文件论坛版2_如果原版登录不上论坛试这个/user_config.json,sha256=_INn1X1qIsITrmEno-BRlQOAGm9wnNCw-6B333DEvnk,695
|
|
67
|
+
cnhkmcp-1.4.4.dist-info/licenses/LICENSE,sha256=QLxO2eNMnJQEdI_R1UV2AOD-IvuA8zVrkHWA4D9gtoc,1081
|
|
68
|
+
cnhkmcp-1.4.4.dist-info/METADATA,sha256=XnYNbWXggfkGLBKvMz0hwOS4AzWH8vdZ_8HT73Yl2WM,5171
|
|
69
|
+
cnhkmcp-1.4.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
70
|
+
cnhkmcp-1.4.4.dist-info/entry_points.txt,sha256=lTQieVyIvjhSMK4fT-XwnccY-JBC1H4vVQ3V9dDM-Pc,70
|
|
71
|
+
cnhkmcp-1.4.4.dist-info/top_level.txt,sha256=x--ibUcSgOS9Z_RWK2Qc-vfs7DaXQN-WMaaxEETJ1Bw,8
|
|
72
|
+
cnhkmcp-1.4.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|