@@ -25,41 +25,21 @@ Instantiate and use the client with the following:
2525
2626``` python
2727from monite import Monite
28-
29- client = Monite(
30- monite_version = " YOUR_MONITE_VERSION" ,
31- monite_entity_id = " YOUR_MONITE_ENTITY_ID" ,
32- token = " YOUR_TOKEN" ,
33- )
34- client.products.create(
35- name = " name" ,
36- )
28+ client = Monite(monite_version = " YOUR_MONITE_VERSION" , monite_entity_id = " YOUR_MONITE_ENTITY_ID" , token = " YOUR_TOKEN" , )
29+ client.products.create(name = ' name' , )
3730```
3831
3932## Async Client
4033
4134The SDK also exports an ` async ` client so that you can make non-blocking calls to our API.
4235
4336``` python
44- import asyncio
45-
4637from monite import AsyncMonite
47-
48- client = AsyncMonite(
49- monite_version = " YOUR_MONITE_VERSION" ,
50- monite_entity_id = " YOUR_MONITE_ENTITY_ID" ,
51- token = " YOUR_TOKEN" ,
52- )
53-
54-
38+ import asyncio
39+ client = AsyncMonite(monite_version = " YOUR_MONITE_VERSION" , monite_entity_id = " YOUR_MONITE_ENTITY_ID" , token = " YOUR_TOKEN" , )
5540async def main () -> None :
56- await client.products.create(
57- name = " name" ,
58- )
59-
60-
61- asyncio.run(main())
62- ```
41+ await client.products.create(name = ' name' , )
42+ asyncio.run(main())```
6343
6444# # Exception Handling
6545
@@ -68,7 +48,6 @@ will be thrown.
6848
6949```python
7050from monite.core.api_error import ApiError
71-
7251try :
7352 client.products.create(... )
7453except ApiError as e:
@@ -78,13 +57,26 @@ except ApiError as e:
7857
7958## Advanced
8059
60+ ### Access Raw Response Data
61+
62+ The SDK provides access to raw response data, including headers, through the ` .with_raw_response ` property.
63+ The ` .with_raw_response ` property returns a "raw" client that can be used to access the ` .headers ` and ` .data ` attributes.
64+
65+ ``` python
66+ from monite import Monite
67+ client = Monite(... , )
68+ response = client.products.with_raw_response.create(... )
69+ print (response.headers) # access the response headers
70+ print (response.data) # access the underlying object
71+ ```
72+
8173### Retries
8274
8375The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
84- as the request is deemed retriable and the number of retry attempts has not grown larger than the configured
76+ as the request is deemed retryable and the number of retry attempts has not grown larger than the configured
8577retry limit (default: 2).
8678
87- A request is deemed retriable when any of the following HTTP status codes is returned:
79+ A request is deemed retryable when any of the following HTTP status codes is returned:
8880
8981- [ 408] ( https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408 ) (Timeout)
9082- [ 429] ( https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429 ) (Too Many Requests)
@@ -105,12 +97,7 @@ The SDK defaults to a 60 second timeout. You can configure this with a timeout o
10597``` python
10698
10799from monite import Monite
108-
109- client = Monite(
110- ... ,
111- timeout = 20.0 ,
112- )
113-
100+ client = Monite(... , timeout = 20.0 , )
114101
115102# Override timeout for a specific method
116103client.products.create(... , request_options = {
@@ -122,18 +109,11 @@ client.products.create(..., request_options={
122109
123110You can override the ` httpx ` client to customize it for your use-case. Some common use-cases include support for proxies
124111and transports.
112+
125113``` python
126- import httpx
127114from monite import Monite
128-
129- client = Monite(
130- ... ,
131- httpx_client = httpx.Client(
132- proxies = " http://my.test.proxy.example.com" ,
133- transport = httpx.HTTPTransport(local_address = " 0.0.0.0" ),
134- ),
135- )
136- ```
115+ import httpx
116+ client = Monite(... , httpx_client = httpx.Client(proxies = " http://my.test.proxy.example.com" , transport = httpx.HTTPTransport(local_address = " 0.0.0.0" ), ))```
137117
138118# # Contributing
139119
0 commit comments