Skip to content

Commit 7839fbf

Browse files
committed
Enhance type hinting for HTTPError constructor and improve code formatting
1 parent 810302a commit 7839fbf

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

serpapi/exceptions.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ class SearchIDNotProvided(ValueError, SerpApiError):
2222
class HTTPError(requests.exceptions.HTTPError, SerpApiError):
2323
"""HTTP Error."""
2424

25-
def __init__(self, original_exception):
26-
if (isinstance(original_exception, requests.exceptions.HTTPError)):
25+
def __init__(self, original_exception: Exception) -> None:
26+
if isinstance(original_exception, requests.exceptions.HTTPError):
2727
http_error_exception: requests.exceptions.HTTPError = original_exception
2828

2929
self.status_code = http_error_exception.response.status_code
@@ -35,7 +35,7 @@ def __init__(self, original_exception):
3535
self.status_code = -1
3636
self.error = None
3737

38-
super().__init__(*original_exception.args, response=getattr(original_exception, 'response', None), request=getattr(original_exception, 'request', None))
38+
super().__init__(*original_exception.args, response=getattr(original_exception, "response", None), request=getattr(original_exception, "request", None))
3939

4040

4141

0 commit comments

Comments
 (0)