Skip to content

Commit

Permalink
feat: 增加pro参数
Browse files Browse the repository at this point in the history
  • Loading branch information
zsrl committed Jun 24, 2023
1 parent 0ca757a commit 6715fd2
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,21 @@ print(res)

非必填,默认为`False`,是否在控制台打印日志。

#### pro

非必填,默认为False,付费版传True,

> 必须传入cookie参数才能使用付费版

#### cookie

非必填,默认为None,付费版可以尝试传入cookie,获取付费使用权限。
非必填,默认为None,免费版可以忽略,付费版必须传入cookie,获取付费使用权限。

```python
pywencai.get(question='近3个月每日市盈率', pro=True, cookie='xxxx')
```


#### request_params

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pywencai"
version = "0.9.1"
version = "0.10.0"
description = ""
authors = ["pluto <[email protected]>"]
readme = "README.md"
Expand Down
8 changes: 8 additions & 0 deletions pywencai/wencai.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ def get_robot_data(**kwargs):
'question': question
}

pro = kwargs.get('pro', False)

if pro:
data['iwcpro'] = 1

log and logger.info(f'获取condition开始')

def do():
Expand Down Expand Up @@ -87,6 +92,7 @@ def get_page(**kwargs):
find = kwargs.pop('find', None)
query_type = kwargs.get('query_type', 'stock')
request_params = kwargs.get('request_params', {})
pro = kwargs.get('pro', False)
if find is None:
data = {
'perpage': 100,
Expand All @@ -95,6 +101,8 @@ def get_page(**kwargs):
**kwargs
}
target_url = 'http://www.iwencai.com/gateway/urp/v7/landing/getDataList'
if pro:
target_url = f'{target_url}?iwcpro=1'
path = 'answer.components.0.data.datas'
else:
if isinstance(find, List):
Expand Down

0 comments on commit 6715fd2

Please sign in to comment.