mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
docs(python): fix example code of Route.fetch (#19840)
This commit is contained in:
parent
9f27b300f4
commit
b2820fccda
@ -454,7 +454,7 @@ page.route("https://dog.ceo/api/breeds/list/all", route -> {
|
|||||||
|
|
||||||
```python async
|
```python async
|
||||||
async def handle(route):
|
async def handle(route):
|
||||||
response = await route.fulfill()
|
response = await route.fetch()
|
||||||
json = await response.json()
|
json = await response.json()
|
||||||
json["message"]["big_red_dog"] = []
|
json["message"]["big_red_dog"] = []
|
||||||
await route.fulfill(response=response, json=json)
|
await route.fulfill(response=response, json=json)
|
||||||
@ -464,7 +464,7 @@ await page.route("https://dog.ceo/api/breeds/list/all", handle)
|
|||||||
|
|
||||||
```python sync
|
```python sync
|
||||||
def handle(route):
|
def handle(route):
|
||||||
response = route.fulfill()
|
response = route.fetch()
|
||||||
json = response.json()
|
json = response.json()
|
||||||
json["message"]["big_red_dog"] = []
|
json["message"]["big_red_dog"] = []
|
||||||
route.fulfill(response=response, json=json)
|
route.fulfill(response=response, json=json)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user