Skip to content

Commit

Permalink
refactor(utility): rename "verify" to "verify_tls_certificate" in Config
Browse files Browse the repository at this point in the history
PR Closed: #1272
  • Loading branch information
linjiX committed Feb 10, 2023
1 parent 97e73b6 commit 1574902
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/source/advanced_features/request_configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Note that the default settings can satisfy most use cases.
* - allowed_retry_status
- | The allowed status for retrying request.
| Default: [429, 500, 502, 503, 504]
* - verify
* - verify_tls_certificate
- | Whether to verify the server's TLS certificate.
| Default: True
* - timeout
Expand Down
10 changes: 7 additions & 3 deletions tensorbay/utility/requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class Config:
allowed_retry_methods: The allowed methods for retrying request.
allowed_retry_status: The allowed status for retrying request.
If both methods and status are fitted, the retrying strategy will work.
verify: Whether to verify the server's TLS certificate.
verify_tls_certificate: Whether to verify the server's TLS certificate.
timeout: Timeout value of the request in seconds.
is_internal: Whether the request is from internal.
Expand All @@ -57,7 +57,7 @@ def __init__(self) -> None:
self.max_retries = 3
self.allowed_retry_methods = ["HEAD", "OPTIONS", "POST", "PUT"]
self.allowed_retry_status = [429, 500, 502, 503, 504]
self.verify = True
self.verify_tls_certificate = True

self.timeout = 30
self.is_internal = False
Expand Down Expand Up @@ -147,7 +147,11 @@ def request( # type: ignore[override]
"""
try:
response = super().request(
method, url, *args, verify=config.verify, **kwargs # type: ignore[misc]
method,
url,
*args,
verify=config.verify_tls_certificate, # type: ignore[misc]
**kwargs,
)
if response.status_code not in (200, 201):
logger.error(
Expand Down

0 comments on commit 1574902

Please sign in to comment.