Skip to content

Commit b2aae0d

Browse files
Merge branch 'main' into feature_tags_field_for_event_handler
2 parents f8ef82d + 1c3fc29 commit b2aae0d

File tree

56 files changed

+6449
-1782
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+6449
-1782
lines changed

README.md

Lines changed: 97 additions & 1165 deletions
Large diffs are not rendered by default.

docs/authentication-retry-policy.md

Lines changed: 513 additions & 0 deletions
Large diffs are not rendered by default.

docs/configuration/README.md

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# Configuration
2+
3+
This section covers various configuration options for the Conductor Python SDK.
4+
5+
## Table of Contents
6+
7+
- [Basic Configuration](../../README.md#configuration) - Basic configuration setup
8+
- [SSL/TLS Configuration](ssl-tls.md) - Secure connections and certificates
9+
- [Proxy Configuration](proxy.md) - Network proxy setup
10+
11+
## Overview
12+
13+
The Conductor Python SDK provides flexible configuration options to work with different environments and security requirements. Configuration can be done through:
14+
15+
1. **Code Configuration** - Direct configuration in your application code
16+
2. **Environment Variables** - Configuration through environment variables
17+
3. **Configuration Files** - External configuration files (future enhancement)
18+
19+
## Quick Start
20+
21+
```python
22+
from conductor.client.configuration.configuration import Configuration
23+
24+
# Basic configuration
25+
config = Configuration()
26+
27+
# Custom server URL
28+
config = Configuration(server_api_url="https://your-server.com/api")
29+
30+
# With authentication
31+
from conductor.shared.configuration.settings.authentication_settings import AuthenticationSettings
32+
config = Configuration(
33+
server_api_url="https://your-server.com/api",
34+
authentication_settings=AuthenticationSettings(
35+
key_id="your_key",
36+
key_secret="your_secret"
37+
)
38+
)
39+
```
40+
41+
## Environment Variables
42+
43+
| Variable | Description | Default |
44+
|----------|-------------|---------|
45+
| `CONDUCTOR_SERVER_URL` | Conductor server API URL | `http://localhost:8080/api` |
46+
| `CONDUCTOR_AUTH_KEY` | Authentication key | None |
47+
| `CONDUCTOR_AUTH_SECRET` | Authentication secret | None |
48+
| `CONDUCTOR_PROXY` | Proxy URL | None |
49+
| `CONDUCTOR_PROXY_HEADERS` | Proxy headers (JSON) | None |
50+
| `CONDUCTOR_SSL_CA_CERT` | CA certificate path | None |
51+
| `CONDUCTOR_CERT_FILE` | Client certificate path | None |
52+
| `CONDUCTOR_KEY_FILE` | Client private key path | None |
53+
54+
## Configuration Examples
55+
56+
### Local Development
57+
58+
```python
59+
config = Configuration() # Uses http://localhost:8080/api
60+
```
61+
62+
### Production with Authentication
63+
64+
```python
65+
config = Configuration(
66+
server_api_url="https://your-cluster.orkesconductor.io/api",
67+
authentication_settings=AuthenticationSettings(
68+
key_id="your_key",
69+
key_secret="your_secret"
70+
)
71+
)
72+
```
73+
74+
### With Proxy
75+
76+
```python
77+
config = Configuration(
78+
server_api_url="https://your-server.com/api",
79+
proxy="http://proxy.company.com:8080"
80+
)
81+
```
82+
83+
### With SSL/TLS
84+
85+
```python
86+
config = Configuration(
87+
server_api_url="https://your-server.com/api",
88+
ssl_ca_cert="/path/to/ca-cert.pem",
89+
cert_file="/path/to/client-cert.pem",
90+
key_file="/path/to/client-key.pem"
91+
)
92+
```
93+
94+
## Advanced Configuration
95+
96+
For more detailed configuration options, see:
97+
98+
- [SSL/TLS Configuration](ssl-tls.md) - Complete SSL/TLS setup guide
99+
- [Proxy Configuration](proxy.md) - Network proxy configuration guide

docs/configuration/proxy.md

Lines changed: 288 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,288 @@
1+
# Proxy Configuration
2+
3+
The Conductor Python SDK supports proxy configuration for both synchronous and asynchronous clients. This is useful when your application needs to route traffic through corporate firewalls, load balancers, or other network intermediaries.
4+
5+
## Table of Contents
6+
7+
- [Supported Proxy Types](#supported-proxy-types)
8+
- [Client Proxy Configuration](#client-proxy-configuration)
9+
- [Environment Variable Configuration](#environment-variable-configuration)
10+
- [Advanced Proxy Configuration](#advanced-proxy-configuration)
11+
- [Troubleshooting](#troubleshooting)
12+
13+
## Supported Proxy Types
14+
15+
- **HTTP Proxy**: `http://proxy.example.com:8080`
16+
- **HTTPS Proxy**: `https://proxy.example.com:8443`
17+
- **SOCKS4 Proxy**: `socks4://proxy.example.com:1080`
18+
- **SOCKS5 Proxy**: `socks5://proxy.example.com:1080`
19+
- **Proxy with Authentication**: `http://username:password@proxy.example.com:8080`
20+
21+
> [!NOTE]
22+
> For SOCKS proxy support, install the additional dependency: `pip install httpx[socks]`
23+
24+
## Client Proxy Configuration
25+
26+
### Basic HTTP Proxy Configuration
27+
28+
```python
29+
from conductor.client.configuration.configuration import Configuration
30+
from conductor.shared.configuration.settings.authentication_settings import AuthenticationSettings
31+
32+
# Basic HTTP proxy configuration
33+
config = Configuration(
34+
server_api_url="https://api.orkes.io/api",
35+
authentication_settings=AuthenticationSettings(
36+
key_id="your_key_id",
37+
key_secret="your_key_secret"
38+
),
39+
proxy="http://proxy.company.com:8080"
40+
)
41+
```
42+
43+
### HTTPS Proxy with Authentication Headers
44+
45+
```python
46+
# HTTPS proxy with authentication headers
47+
config = Configuration(
48+
server_api_url="https://api.orkes.io/api",
49+
authentication_settings=AuthenticationSettings(
50+
key_id="your_key_id",
51+
key_secret="your_key_secret"
52+
),
53+
proxy="https://secure-proxy.company.com:8443",
54+
proxy_headers={
55+
"Proxy-Authorization": "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
56+
"X-Proxy-Client": "conductor-python-sdk"
57+
}
58+
)
59+
```
60+
61+
### SOCKS Proxy Configuration
62+
63+
```python
64+
# SOCKS5 proxy configuration
65+
config = Configuration(
66+
server_api_url="https://api.orkes.io/api",
67+
proxy="socks5://proxy.company.com:1080"
68+
)
69+
70+
# SOCKS5 proxy with authentication
71+
config = Configuration(
72+
server_api_url="https://api.orkes.io/api",
73+
proxy="socks5://username:password@proxy.company.com:1080"
74+
)
75+
```
76+
77+
## Environment Variable Configuration
78+
79+
You can configure proxy settings using Conductor-specific environment variables:
80+
81+
```shell
82+
# Basic proxy configuration
83+
export CONDUCTOR_PROXY=http://proxy.company.com:8080
84+
85+
# Proxy with authentication headers (JSON format)
86+
export CONDUCTOR_PROXY_HEADERS='{"Proxy-Authorization": "Basic dXNlcm5hbWU6cGFzc3dvcmQ=", "X-Proxy-Client": "conductor-python-sdk"}'
87+
88+
# Or single header value
89+
export CONDUCTOR_PROXY_HEADERS="Basic dXNlcm5hbWU6cGFzc3dvcmQ="
90+
```
91+
92+
**Priority Order:**
93+
1. Explicit proxy parameters in Configuration constructor
94+
2. `CONDUCTOR_PROXY` and `CONDUCTOR_PROXY_HEADERS` environment variables
95+
96+
### Example Usage with Environment Variables
97+
98+
```python
99+
# Set environment variables
100+
import os
101+
os.environ['CONDUCTOR_PROXY'] = 'http://proxy.company.com:8080'
102+
os.environ['CONDUCTOR_PROXY_HEADERS'] = '{"Proxy-Authorization": "Basic dXNlcm5hbWU6cGFzc3dvcmQ="}'
103+
104+
# Configuration will automatically use proxy from environment
105+
from conductor.client.configuration.configuration import Configuration
106+
config = Configuration(server_api_url="https://api.orkes.io/api")
107+
# Proxy is automatically configured from CONDUCTOR_PROXY environment variable
108+
```
109+
110+
## Advanced Proxy Configuration
111+
112+
### Custom HTTP Client with Proxy
113+
114+
```python
115+
import httpx
116+
from conductor.client.configuration.configuration import Configuration
117+
118+
# Create custom HTTP client with proxy
119+
custom_client = httpx.Client(
120+
proxies={
121+
"http://": "http://proxy.company.com:8080",
122+
"https://": "http://proxy.company.com:8080"
123+
},
124+
timeout=httpx.Timeout(120.0),
125+
follow_redirects=True,
126+
limits=httpx.Limits(max_keepalive_connections=20, max_connections=100),
127+
)
128+
129+
config = Configuration(
130+
server_api_url="https://api.orkes.io/api",
131+
http_connection=custom_client
132+
)
133+
```
134+
135+
### Proxy with Custom Headers
136+
137+
```python
138+
import httpx
139+
from conductor.client.configuration.configuration import Configuration
140+
141+
# Create custom HTTP client with proxy and headers
142+
custom_client = httpx.Client(
143+
proxies={
144+
"http://": "http://proxy.company.com:8080",
145+
"https://": "http://proxy.company.com:8080"
146+
},
147+
headers={
148+
"Proxy-Authorization": "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
149+
"X-Proxy-Client": "conductor-python-sdk",
150+
"User-Agent": "Conductor-Python-SDK/1.0"
151+
}
152+
)
153+
154+
config = Configuration(
155+
server_api_url="https://api.orkes.io/api",
156+
http_connection=custom_client
157+
)
158+
```
159+
160+
### SOCKS Proxy with Authentication
161+
162+
```python
163+
import httpx
164+
from conductor.client.configuration.configuration import Configuration
165+
166+
# SOCKS5 proxy with authentication
167+
custom_client = httpx.Client(
168+
proxies={
169+
"http://": "socks5://username:password@proxy.company.com:1080",
170+
"https://": "socks5://username:password@proxy.company.com:1080"
171+
}
172+
)
173+
174+
config = Configuration(
175+
server_api_url="https://api.orkes.io/api",
176+
http_connection=custom_client
177+
)
178+
```
179+
180+
### Async Client Proxy Configuration
181+
182+
```python
183+
import asyncio
184+
import httpx
185+
from conductor.asyncio_client.configuration import Configuration
186+
from conductor.asyncio_client.adapters import ApiClient
187+
188+
async def main():
189+
# Create async HTTP client with proxy
190+
async_client = httpx.AsyncClient(
191+
proxies={
192+
"http://": "http://proxy.company.com:8080",
193+
"https://": "http://proxy.company.com:8080"
194+
}
195+
)
196+
197+
config = Configuration(
198+
server_url="https://api.orkes.io/api",
199+
http_connection=async_client
200+
)
201+
202+
async with ApiClient(config) as api_client:
203+
# Use the client with proxy configuration
204+
pass
205+
206+
asyncio.run(main())
207+
```
208+
209+
## Troubleshooting
210+
211+
### Common Proxy Issues
212+
213+
1. **Connection refused**
214+
- Check if the proxy server is running
215+
- Verify the proxy URL and port
216+
- Check firewall settings
217+
218+
2. **Authentication failed**
219+
- Verify username and password
220+
- Check if the proxy requires specific authentication method
221+
- Ensure credentials are properly encoded
222+
223+
3. **SOCKS proxy not working**
224+
- Install httpx with SOCKS support: `pip install httpx[socks]`
225+
- Check if the SOCKS proxy server is accessible
226+
- Verify SOCKS version (4 or 5)
227+
228+
4. **SSL/TLS issues through proxy**
229+
- Some proxies don't support HTTPS properly
230+
- Try using HTTP proxy for HTTPS traffic
231+
- Check proxy server SSL configuration
232+
233+
### Debug Proxy Configuration
234+
235+
```python
236+
import httpx
237+
import logging
238+
239+
# Enable debug logging
240+
logging.basicConfig(level=logging.DEBUG)
241+
242+
# Test proxy connection
243+
def test_proxy_connection(proxy_url):
244+
try:
245+
with httpx.Client(proxies={"http://": proxy_url, "https://": proxy_url}) as client:
246+
response = client.get("http://httpbin.org/ip")
247+
print(f"Proxy test successful: {response.json()}")
248+
except Exception as e:
249+
print(f"Proxy test failed: {e}")
250+
251+
# Test your proxy
252+
test_proxy_connection("http://proxy.company.com:8080")
253+
```
254+
255+
### Proxy Environment Variables
256+
257+
```bash
258+
# Set proxy environment variables for testing
259+
export HTTP_PROXY=http://proxy.company.com:8080
260+
export HTTPS_PROXY=http://proxy.company.com:8080
261+
export NO_PROXY=localhost,127.0.0.1
262+
263+
# Test with curl
264+
curl -I https://api.orkes.io/api
265+
```
266+
267+
### Proxy Authentication
268+
269+
```python
270+
import base64
271+
from urllib.parse import quote
272+
273+
# Create proxy authentication header
274+
username = "your_username"
275+
password = "your_password"
276+
credentials = f"{username}:{password}"
277+
encoded_credentials = base64.b64encode(credentials.encode()).decode()
278+
279+
proxy_headers = {
280+
"Proxy-Authorization": f"Basic {encoded_credentials}"
281+
}
282+
283+
config = Configuration(
284+
server_api_url="https://api.orkes.io/api",
285+
proxy="http://proxy.company.com:8080",
286+
proxy_headers=proxy_headers
287+
)
288+
```

0 commit comments

Comments
 (0)