Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: detect Python methods as properties correctly #1111

Merged
merged 3 commits into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 38 additions & 36 deletions python/docs/api/class-apiresponse.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,44 @@ api_response.dispose()

---

### json {#api-response-json}

<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.16</font><x-search>apiResponse.json</x-search>

Returns the JSON representation of response body.

This method will throw if the response body is not parsable via `JSON.parse`.

**Usage**

```python
api_response.json()
```

**Returns**
- [Serializable]<a aria-hidden="true" tabindex="-1" class="list-anchor-link" id="api-response-json-return"/><a href="#api-response-json-return" class="list-anchor">#</a>

---

### text {#api-response-text}

<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.16</font><x-search>apiResponse.text</x-search>

Returns the text representation of response body.

**Usage**

```python
api_response.text()
```

**Returns**
- [str]<a aria-hidden="true" tabindex="-1" class="list-anchor-link" id="api-response-text-return"/><a href="#api-response-text-return" class="list-anchor">#</a>

---

## Properties

### headers {#api-response-headers}

<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.16</font><x-search>apiResponse.headers</x-search>
Expand Down Expand Up @@ -135,25 +173,6 @@ api_response.headers_array

---

### json {#api-response-json}

<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.16</font><x-search>apiResponse.json</x-search>

Returns the JSON representation of response body.

This method will throw if the response body is not parsable via `JSON.parse`.

**Usage**

```python
api_response.json()
```

**Returns**
- [Serializable]<a aria-hidden="true" tabindex="-1" class="list-anchor-link" id="api-response-json-return"/><a href="#api-response-json-return" class="list-anchor">#</a>

---

### ok {#api-response-ok}

<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.16</font><x-search>apiResponse.ok</x-search>
Expand Down Expand Up @@ -205,23 +224,6 @@ api_response.status_text

---

### text {#api-response-text}

<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.16</font><x-search>apiResponse.text</x-search>

Returns the text representation of response body.

**Usage**

```python
api_response.text()
```

**Returns**
- [str]<a aria-hidden="true" tabindex="-1" class="list-anchor-link" id="api-response-text-return"/><a href="#api-response-text-return" class="list-anchor">#</a>

---

### url {#api-response-url}

<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.16</font><x-search>apiResponse.url</x-search>
Expand Down
156 changes: 79 additions & 77 deletions python/docs/api/class-browser.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -62,23 +62,6 @@ asyncio.run(main())

## Methods

### browser_type {#browser-browser-type}

<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.23</font><x-search>browser.browser_type</x-search>

Get the browser type (chromium, firefox or webkit) that the browser belongs to.

**Usage**

```python
browser.browser_type
```

**Returns**
- [BrowserType]<a aria-hidden="true" tabindex="-1" class="list-anchor-link" id="browser-browser-type-return"/><a href="#browser-browser-type-return" class="list-anchor">#</a>

---

### close {#browser-close}

<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.8</font><x-search>browser.close</x-search>
Expand All @@ -101,66 +84,6 @@ browser.close()

---

### contexts {#browser-contexts}

<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.8</font><x-search>browser.contexts</x-search>

Returns an array of all open browser contexts. In a newly created browser, this will return zero browser contexts.

**Usage**

<Tabs
groupId="python-flavor"
defaultValue="sync"
values={[
{label: 'Sync', value: 'sync'},
{label: 'Async', value: 'async'}
]
}>
<TabItem value="sync">

```py
browser = pw.webkit.launch()
print(len(browser.contexts())) # prints `0`
context = browser.new_context()
print(len(browser.contexts())) # prints `1`
```

</TabItem>
<TabItem value="async">

```py
browser = await pw.webkit.launch()
print(len(browser.contexts())) # prints `0`
context = await browser.new_context()
print(len(browser.contexts())) # prints `1`
```

</TabItem>
</Tabs>

**Returns**
- [List]\[[BrowserContext]\]<a aria-hidden="true" tabindex="-1" class="list-anchor-link" id="browser-contexts-return"/><a href="#browser-contexts-return" class="list-anchor">#</a>

---

### is_connected {#browser-is-connected}

<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.8</font><x-search>browser.is_connected</x-search>

Indicates that the browser is connected.

**Usage**

```python
browser.is_connected()
```

**Returns**
- [bool]<a aria-hidden="true" tabindex="-1" class="list-anchor-link" id="browser-is-connected-return"/><a href="#browser-is-connected-return" class="list-anchor">#</a>

---

### new_browser_cdp_session {#browser-new-browser-cdp-session}

<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.11</font><x-search>browser.new_browser_cdp_session</x-search>
Expand Down Expand Up @@ -732,6 +655,85 @@ browser.stop_tracing()

---

## Properties

### browser_type {#browser-browser-type}

<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.23</font><x-search>browser.browser_type</x-search>

Get the browser type (chromium, firefox or webkit) that the browser belongs to.

**Usage**

```python
browser.browser_type
```

**Returns**
- [BrowserType]<a aria-hidden="true" tabindex="-1" class="list-anchor-link" id="browser-browser-type-return"/><a href="#browser-browser-type-return" class="list-anchor">#</a>

---

### contexts {#browser-contexts}

<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.8</font><x-search>browser.contexts</x-search>

Returns an array of all open browser contexts. In a newly created browser, this will return zero browser contexts.

**Usage**

<Tabs
groupId="python-flavor"
defaultValue="sync"
values={[
{label: 'Sync', value: 'sync'},
{label: 'Async', value: 'async'}
]
}>
<TabItem value="sync">

```py
browser = pw.webkit.launch()
print(len(browser.contexts())) # prints `0`
context = browser.new_context()
print(len(browser.contexts())) # prints `1`
```

</TabItem>
<TabItem value="async">

```py
browser = await pw.webkit.launch()
print(len(browser.contexts())) # prints `0`
context = await browser.new_context()
print(len(browser.contexts())) # prints `1`
```

</TabItem>
</Tabs>

**Returns**
- [List]\[[BrowserContext]\]<a aria-hidden="true" tabindex="-1" class="list-anchor-link" id="browser-contexts-return"/><a href="#browser-contexts-return" class="list-anchor">#</a>

---

### is_connected {#browser-is-connected}

<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.8</font><x-search>browser.is_connected</x-search>

Indicates that the browser is connected.

**Usage**

```python
browser.is_connected()
```

**Returns**
- [bool]<a aria-hidden="true" tabindex="-1" class="list-anchor-link" id="browser-is-connected-return"/><a href="#browser-is-connected-return" class="list-anchor">#</a>

---

### version {#browser-version}

<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.8</font><x-search>browser.version</x-search>
Expand Down
Loading
Loading