Update the caller class
- has now ErrorResponse return values instead of None on errors - changed parameter cafile to ca_file and its position in the init method - Proxy has ProxyConfig Typed Dict format Tests updates to reflect those changes
This commit is contained in:
@@ -45,14 +45,14 @@ class Caller:
|
||||
def __init__(
|
||||
self,
|
||||
header: dict[str, str],
|
||||
verify: bool = True,
|
||||
timeout: int = 20,
|
||||
proxy: ProxyConfig | None = None,
|
||||
cafile: str | None = None
|
||||
verify: bool = True,
|
||||
ca_file: str | None = None
|
||||
):
|
||||
self.headers = header
|
||||
self.timeout: int = timeout
|
||||
self.cafile = cafile
|
||||
self.ca_file = ca_file
|
||||
self.verify = verify
|
||||
self.proxy = cast(dict[str, str], proxy) if proxy is not None else None
|
||||
|
||||
@@ -93,7 +93,7 @@ class Caller:
|
||||
timeout=self.__timeout(timeout),
|
||||
verify=self.verify,
|
||||
proxies=self.proxy,
|
||||
cert=self.cafile
|
||||
cert=self.ca_file
|
||||
)
|
||||
if action == "post":
|
||||
return requests.post(
|
||||
@@ -104,7 +104,7 @@ class Caller:
|
||||
timeout=self.__timeout(timeout),
|
||||
verify=self.verify,
|
||||
proxies=self.proxy,
|
||||
cert=self.cafile
|
||||
cert=self.ca_file
|
||||
)
|
||||
if action == "put":
|
||||
return requests.put(
|
||||
@@ -115,7 +115,7 @@ class Caller:
|
||||
timeout=self.__timeout(timeout),
|
||||
verify=self.verify,
|
||||
proxies=self.proxy,
|
||||
cert=self.cafile
|
||||
cert=self.ca_file
|
||||
)
|
||||
if action == "patch":
|
||||
return requests.patch(
|
||||
@@ -126,7 +126,7 @@ class Caller:
|
||||
timeout=self.__timeout(timeout),
|
||||
verify=self.verify,
|
||||
proxies=self.proxy,
|
||||
cert=self.cafile
|
||||
cert=self.ca_file
|
||||
)
|
||||
if action == "delete":
|
||||
return requests.delete(
|
||||
@@ -136,7 +136,7 @@ class Caller:
|
||||
timeout=self.__timeout(timeout),
|
||||
verify=self.verify,
|
||||
proxies=self.proxy,
|
||||
cert=self.cafile
|
||||
cert=self.ca_file
|
||||
)
|
||||
return ErrorResponse(
|
||||
100,
|
||||
|
||||
Reference in New Issue
Block a user