Skip to content

Commit deeb4c5

Browse files
committed
rabbit
1 parent 65aae1c commit deeb4c5

File tree

1 file changed

+56
-22
lines changed

1 file changed

+56
-22
lines changed

docs/docs/python-sdk/guides/client.mdx

Lines changed: 56 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,16 @@ Use `INFRAHUB_PROXY` environment variable or the `proxy` configuration parameter
145145

146146
```python
147147
from infrahub_sdk import Config, InfrahubClient
148-
config = Config(proxy="http://proxy.example.com:8080")
148+
# Programmatic configuration
149+
config = Config(proxy_mounts={
150+
"http": "http://http-proxy.example.com:8080",
151+
"https": "http://https-proxy.example.com:8080",
152+
})
149153
client = InfrahubClient(config=config)
150-
151-
# Or using environment variable
152-
# export INFRAHUB_PROXY=http://proxy.example.com:8080
154+
155+
# Or using environment variables
156+
# export INFRAHUB_PROXY_MOUNTS_HTTP=http://http-proxy.example.com:8080
157+
# export INFRAHUB_PROXY_MOUNTS_HTTPS=http://https-proxy.example.com:8080
153158
client = InfrahubClient()
154159
```
155160

@@ -158,24 +163,52 @@ Use `INFRAHUB_PROXY` environment variable or the `proxy` configuration parameter
158163

159164
```python
160165
from infrahub_sdk import Config, InfrahubClientSync
161-
config = Config(proxy="http://proxy.example.com:8080")
166+
# Programmatic configuration
167+
config = Config(proxy_mounts={
168+
"http": "http://http-proxy.example.com:8080",
169+
"https": "http://https-proxy.example.com:8080",
170+
})
162171
client = InfrahubClientSync(config=config)
163-
164-
# Or using environment variable
165-
# export INFRAHUB_PROXY=http://proxy.example.com:8080
166-
client = InfrahubClientSync()
167-
```
168-
169-
</TabItem>
170-
</Tabs>
171-
172-
### Separate proxies for HTTP and HTTPS
173-
174-
Use `INFRAHUB_PROXY_MOUNTS_HTTP` and `INFRAHUB_PROXY_MOUNTS_HTTPS` environment variables to configure different proxies for HTTP and HTTPS requests:
175-
176-
```bash
177-
export INFRAHUB_PROXY_MOUNTS_HTTP=http://http-proxy.example.com:8080
178-
export INFRAHUB_PROXY_MOUNTS_HTTPS=http://https-proxy.example.com:8080
172+
### Separate proxies for HTTP and HTTPS
173+
174+
<Tabs groupId="async-sync">
175+
<TabItem value="Async" default>
176+
177+
```python
178+
from infrahub_sdk import Config, InfrahubClient
179+
# Programmatic configuration
180+
config = Config(proxy_mounts={
181+
"http": "http://http-proxy.example.com:8080",
182+
"https": "http://https-proxy.example.com:8080",
183+
})
184+
client = InfrahubClient(config=config)
185+
186+
# Or using environment variables
187+
# export INFRAHUB_PROXY_MOUNTS_HTTP=http://http-proxy.example.com:8080
188+
# export INFRAHUB_PROXY_MOUNTS_HTTPS=http://https-proxy.example.com:8080
189+
client = InfrahubClient()
190+
```
191+
192+
</TabItem>
193+
<TabItem value="Sync">
194+
195+
```python
196+
from infrahub_sdk import Config, InfrahubClientSync
197+
# Programmatic configuration
198+
config = Config(proxy_mounts={
199+
"http": "http://http-proxy.example.com:8080",
200+
"https": "http://https-proxy.example.com:8080",
201+
})
202+
client = InfrahubClientSync(config=config)
203+
204+
# Or using environment variables
205+
# export INFRAHUB_PROXY_MOUNTS_HTTP=http://http-proxy.example.com:8080
206+
# export INFRAHUB_PROXY_MOUNTS_HTTPS=http://https-proxy.example.com:8080
207+
client = InfrahubClientSync()
208+
```
209+
210+
</TabItem>
211+
</Tabs>
179212
```
180213
181214
<Tabs groupId="async-sync">
@@ -243,6 +276,7 @@ To verify your client is properly configured and can connect to Infrahub, test t
243276

244277
```python
245278
from infrahub_sdk import InfrahubClient, Config
279+
import asyncio
246280

247281
# Test connection and authentication
248282
async def test_connection():
@@ -256,7 +290,7 @@ To verify your client is properly configured and can connect to Infrahub, test t
256290
print(f"Connection failed: {e}")
257291

258292
# Run the test
259-
await test_connection()
293+
asyncio.run(test_connection())
260294
```
261295

262296
</TabItem>

0 commit comments

Comments
 (0)