Skip to content

Commit 42c601f

Browse files
committed
sanity checking
1 parent deeb4c5 commit 42c601f

File tree

1 file changed

+27
-60
lines changed

1 file changed

+27
-60
lines changed

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

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

146146
```python
147147
from infrahub_sdk import Config, InfrahubClient
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-
})
148+
config = Config(proxy="http://proxy.example.com:8080")
153149
client = InfrahubClient(config=config)
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
150+
151+
# Or using environment variable
152+
# export INFRAHUB_PROXY=http://proxy.example.com:8080
158153
client = InfrahubClient()
159154
```
160155

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

164159
```python
165160
from infrahub_sdk import Config, InfrahubClientSync
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-
})
161+
config = Config(proxy="http://proxy.example.com:8080")
171162
client = InfrahubClientSync(config=config)
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>
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
212179
```
213180

214181
<Tabs groupId="async-sync">
@@ -282,10 +249,10 @@ To verify your client is properly configured and can connect to Infrahub, test t
282249
async def test_connection():
283250
client = InfrahubClient(address="http://localhost:8000")
284251

285-
# Try to fetch schema to validate connection
252+
# Try to query accounts to validate connection
286253
try:
287-
schema = await client.schema.get()
288-
print(f"Successfully connected to Infrahub! Schema version: {schema.version}")
254+
accounts = await client.all(kind="CoreAccount")
255+
print(f"Successfully connected to Infrahub! Found {len(accounts)} accounts")
289256
except Exception as e:
290257
print(f"Connection failed: {e}")
291258

@@ -303,10 +270,10 @@ To verify your client is properly configured and can connect to Infrahub, test t
303270
def test_connection():
304271
client = InfrahubClientSync(address="http://localhost:8000")
305272

306-
# Try to fetch schema to validate connection
273+
# Try to query accounts to validate connection
307274
try:
308-
schema = client.schema.get()
309-
print(f"Successfully connected to Infrahub! Schema version: {schema.version}")
275+
accounts = client.all(kind="CoreAccount")
276+
print(f"Successfully connected to Infrahub! Found {len(accounts)} accounts")
310277
except Exception as e:
311278
print(f"Connection failed: {e}")
312279

0 commit comments

Comments
 (0)