-
Notifications
You must be signed in to change notification settings - Fork 86
Open
Description
Description
It is currently not possible to configure HTTP/HTTPS proxy for the SDK in a clean and supported way.
Although Configuration supports a proxy field (and RESTClientObject correctly uses it to create a urllib3.ProxyManager), the ApiClient constructor does not allow passing a custom Configuration instance.
As a result, users cannot configure proxy without modifying internal objects or monkey-patching.
Root Cause
From current implementation:
class ApiClient(object):
def __init__(...):
config = Configuration()
self.rest_client = RESTClientObject(configuration=config)This means:
Configuration.proxyis ignored unless we manually modifyrest_client- Environment variables like
HTTP_PROXY/HTTPS_PROXYare not used - Users have no official way to configure proxy
Expected Behavior
Users should be able to do:
from docusign_esign import ApiClient, Configuration
config = Configuration()
config.proxy = "http://127.0.0.1:3129"
client = ApiClient(configuration=config)Actual Behavior
There is no way to pass configuration into ApiClient.
The only workaround is:
import urllib3
from docusign_esign import ApiClient
client = ApiClient()
client.rest_client.pool_manager = urllib3.ProxyManager(proxy_url="http://127.0.0.1:3129")This is:
- Not documented
- Fragile (depends on internal implementation)
- Not ideal for production usage
Minimal Reproducible Example
from docusign_esign import ApiClient, Configuration
config = Configuration()
config.proxy = "http://127.0.0.1:3129"
# This does NOT work because ApiClient ignores config
client = ApiClient()
print(type(client.rest_client.pool_manager))
# -> urllib3.poolmanager.PoolManager (proxy not used)Related Issue
This seems related to a previously reported issue:
👉 #194
However, the issue still exists because:
- There is still no way to inject
ConfigurationintoApiClient - Proxy support is effectively unusable without internal hacks
Suggested Fix
Update ApiClient to accept a configuration parameter:
def __init__(..., configuration=None):
if configuration is None:
configuration = Configuration()
self.rest_client = RESTClientObject(configuration=configuration)This would:
- Align with how many other SDKs handle configuration
- Enable proper proxy usage
- Avoid monkey patching
Additional Notes
- Proxy is a common requirement in enterprise environments
- Current behavior makes the SDK difficult to use behind corporate proxies
- This change would be backward-compatible
Environment
- Python version: (your version)
- SDK version: (your version)
- OS: (Windows / Linux / etc.)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels