Skip to content

Commit e9887b5

Browse files
Rename 'cafile' to 'ca_file' in ClientConfig for consistency
1 parent f4980bb commit e9887b5

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

USAGE.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ When connecting to a 1Password Connect server using HTTPS, you may need to confi
4141
from onepasswordconnectsdk.config import ClientConfig
4242

4343
# Verify SSL using a custom CA certificate
44-
config = ClientConfig(cafile="path/to/ca.pem")
44+
config = ClientConfig(ca_file="path/to/ca.pem")
4545
client = new_client("https://connect.example.com", "your-token", config=config)
4646

4747
# Disable SSL verification (not recommended for production)
@@ -56,7 +56,7 @@ The ClientConfig class accepts all httpx client options as keyword arguments. Th
5656
```python
5757
# Configure timeouts and redirects
5858
config = ClientConfig(
59-
cafile="path/to/ca.pem",
59+
ca_file="path/to/ca.pem",
6060
timeout=30.0, # 30 second timeout
6161
follow_redirects=True, # Follow HTTP redirects
6262
max_redirects=5 # Maximum number of redirects to follow
@@ -85,7 +85,7 @@ The same configuration options work for both synchronous and asynchronous client
8585

8686
```python
8787
config = ClientConfig(
88-
cafile="path/to/ca.pem",
88+
ca_file="path/to/ca.pem",
8989
timeout=30.0
9090
)
9191
async_client = new_client("https://connect.example.com", "your-token", is_async=True, config=config)

example/ca_file_example/list_secrets.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def list_vault_secrets():
2525
try:
2626
# Configure client with CA certificate verification
2727
config = ClientConfig(
28-
cafile=CA_FILE,
28+
ca_file=CA_FILE,
2929
timeout=30.0 # 30 second timeout
3030
)
3131

@@ -53,7 +53,7 @@ async def list_vault_secrets_async():
5353
try:
5454
# Configure client with CA certificate verification
5555
config = ClientConfig(
56-
cafile=CA_FILE,
56+
ca_file=CA_FILE,
5757
timeout=30.0 # 30 second timeout
5858
)
5959

src/onepasswordconnectsdk/config.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def __init__(self, ca_file: Optional[str] = None, **kwargs):
2727
"""Initialize client configuration
2828
2929
Args:
30-
cafile (Optional[str]): Path to CA certificate file for SSL verification
30+
ca_file (Optional[str]): Path to CA certificate file for SSL verification
3131
**kwargs: Additional httpx client options
3232
"""
3333
self.ca_file = ca_file
@@ -50,9 +50,9 @@ def get_client_args(self, base_url: str, headers: Dict[str, str], timeout: float
5050
'timeout': timeout,
5151
}
5252

53-
# Set verify from cafile first
54-
if self.cafile:
55-
args['verify'] = self.cafile
53+
# Set verify from ca_file first
54+
if self.ca_file:
55+
args['verify'] = self.ca_file
5656

5757
# Allow httpx_options (including verify) to override
5858
args.update(self.httpx_options)

src/tests/test_client_config.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
from onepasswordconnectsdk.config import ClientConfig
33
import httpx
44

5-
def test_client_config_with_cafile():
6-
config = ClientConfig(cafile="path/to/ca.pem")
5+
def test_client_config_with_ca_file():
6+
config = ClientConfig(ca_file="path/to/ca.pem")
77
args = config.get_client_args("https://test.com", {"Authorization": "Bearer token"}, 30.0)
88

99
assert args["verify"] == "path/to/ca.pem"
@@ -13,7 +13,7 @@ def test_client_config_with_cafile():
1313

1414
def test_client_config_with_kwargs():
1515
config = ClientConfig(
16-
cafile="path/to/ca.pem",
16+
ca_file="path/to/ca.pem",
1717
follow_redirects=True,
1818
timeout=60.0
1919
)
@@ -25,16 +25,16 @@ def test_client_config_with_kwargs():
2525
assert args["timeout"] == 60.0
2626

2727
def test_client_config_verify_override():
28-
# When verify is explicitly set in kwargs, it should override cafile
28+
# When verify is explicitly set in kwargs, it should override ca_file
2929
config = ClientConfig(
30-
cafile="path/to/ca.pem",
30+
ca_file="path/to/ca.pem",
3131
verify=False
3232
)
3333
args = config.get_client_args("https://test.com", {"Authorization": "Bearer token"}, 30.0)
3434

3535
assert args["verify"] == False
3636

37-
def test_client_config_no_cafile():
37+
def test_client_config_no_ca_file():
3838
config = ClientConfig()
3939
args = config.get_client_args("https://test.com", {"Authorization": "Bearer token"}, 30.0)
4040

0 commit comments

Comments
 (0)