Skip to content

Commit

Permalink
Correct type hints for client certificate
Browse files Browse the repository at this point in the history
  • Loading branch information
quality-leftovers committed Jan 15, 2024
1 parent 877f037 commit 6bbf70a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions tusclient/client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Dict, Optional, Tuple
from typing import Dict, Optional, Tuple, Union

from tusclient.uploader import Uploader, AsyncUploader

Expand All @@ -16,18 +16,18 @@ class TusClient:
along with every request made by the cleint to the server. This may be used to set
authentication headers. These headers should not include headers required by tus
protocol. If not set this defaults to an empty dictionary.
- client_cert (tuple):
- client_cert (str|tuple[str,str]):
Path of PEM encoded client certitifacate and optionally path to PEM encoded
key file. The PEM encoded key of the certificate can either be included in the
certificate itself or be provided in a seperate file.
Only unencrypted keys are supported!
:Constructor Args:
- url (str)
- headers (Optiional[dict])
- client_cert (Optional[Tuple[str, str]])
- client_cert (Optional[str | Tuple[str, str]])
"""

def __init__(self, url: str, headers: Optional[Dict[str, str]] = None, client_cert: Optional[Tuple[str, str]] = None):
def __init__(self, url: str, headers: Optional[Dict[str, str]] = None, client_cert: Optional[Union[str, Tuple[str, str]]] = None):
self.url = url
self.headers = headers or {}
self.client_cert = client_cert
Expand Down
4 changes: 2 additions & 2 deletions tusclient/uploader/baseuploader.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Optional, IO, Dict, Tuple, TYPE_CHECKING
from typing import Optional, IO, Dict, Tuple, TYPE_CHECKING, Union
import os
import re
from base64 import b64encode
Expand Down Expand Up @@ -103,7 +103,7 @@ def __init__(self, file_path: Optional[str] = None, file_stream: Optional[IO] =
url_storage: Optional[Storage] = None,
fingerprinter: Optional[interface.Fingerprint] = None,
upload_checksum=False,
client_cert: Optional[Tuple[str, str]] = None):
client_cert: Optional[ Union[str, Tuple[str, str] ]] = None):
if file_path is None and file_stream is None:
raise ValueError(
"Either 'file_path' or 'file_stream' cannot be None.")
Expand Down

0 comments on commit 6bbf70a

Please sign in to comment.