Skip to content

Commit e1effdb

Browse files
authored
📝 Docs: add warning to recommend reusing client (#288)
1 parent ddd07e9 commit e1effdb

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

docs/usage/rest-api.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,10 @@ You can make multiple requests with the same client instance in one context:
205205
repo: FullRepository = resp.parsed_data
206206
```
207207

208+
!!! warning
209+
210+
Repeatedly creating new client instances may lead to memory leaks. We recommend reusing the same client instance within a single context to avoid this issue.
211+
208212
## Data Validation
209213

210214
As shown above, the response data is parsed and validated by accessing the `response.parsed_data` property. This ensures that the data type returned by the API is as expected and your code is safe to use it (with static type checking). But sometimes you may want to get the raw data returned by the API, such as when the schema is not correct. You can use the `response.text` property or `response.json()` method to get the raw data. The loaded json data is also typed but not validated. For example:

0 commit comments

Comments
 (0)