mirror of
https://gitee.com/g1879/DrissionPage.git
synced 2024-12-10 04:00:23 +08:00
修改文档
This commit is contained in:
parent
91945adb8a
commit
0de35bf08e
@ -52,10 +52,8 @@ page.get(url, headers=headers, cookies=cookies, proxies=proxies)
|
|||||||
|
|
||||||
# post()
|
# post()
|
||||||
|
|
||||||
该方法是用 post 方式请求页面。大致用法与`get()`一致,但增加一个`data`参数。
|
此方法是用 post 方式请求页面。大致用法与`get()`一致,但增加一个`data`参数。
|
||||||
只有 s 模式拥有,调用该方法时,页面对象会自动切换到 s 模式。
|
此方法只有 s 模式拥有,调用时,页面对象会自动切换到 s 模式。
|
||||||
与 requests 不一样的是,`post()`只使用一个`data`参数,而不区分`data`和`json`,要传入 json 参数的值也是传入 data。
|
|
||||||
是否须要增加`json`参数有待考察,如有须要请与本库作者联系。
|
|
||||||
|
|
||||||
参数:
|
参数:
|
||||||
|
|
||||||
@ -67,13 +65,18 @@ page.get(url, headers=headers, cookies=cookies, proxies=proxies)
|
|||||||
- interval:重试间隔(秒),与页面对象的设置一致,默认 2 秒
|
- interval:重试间隔(秒),与页面对象的设置一致,默认 2 秒
|
||||||
- **kwargs:连接参数,s 模式专用
|
- **kwargs:连接参数,s 模式专用
|
||||||
|
|
||||||
|
?> **Tips:** <br>
|
||||||
|
虽然参数里没有`json`参数,但也和 requests 一样可以对`json`参数传值。
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from DrissionPage import MixPage
|
from DrissionPage import MixPage
|
||||||
|
|
||||||
page = MixPage('s')
|
page = MixPage('s')
|
||||||
|
|
||||||
data = {'username': 'xxxxx', 'pwd': 'xxxxx'}
|
data = {'username': 'xxxxx', 'pwd': 'xxxxx'}
|
||||||
|
|
||||||
page.post('http://example.com', data=data)
|
page.post('http://example.com', data=data)
|
||||||
|
# 或
|
||||||
|
page.post('http://example.com', json=data)
|
||||||
```
|
```
|
||||||
|
|
||||||
# 其它请求方式
|
# 其它请求方式
|
||||||
|
Loading…
x
Reference in New Issue
Block a user