Skip to content

Commit 7ff0352

Browse files
Use shared plain-int helper in transport status parsing
Co-authored-by: Shri Sukhani <shrisukhani@users.noreply.github.com>
1 parent 5d7fcca commit 7ff0352

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

hyperbrowser/transport/async_transport.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
from hyperbrowser.exceptions import HyperbrowserError
55
from hyperbrowser.header_utils import merge_headers
6+
from hyperbrowser.type_utils import is_plain_int
67
from hyperbrowser.version import __version__
78
from .base import APIResponse, AsyncTransportStrategy, _normalize_transport_api_key
89
from .error_utils import (
@@ -34,7 +35,7 @@ def __init__(self, api_key: str, headers: Optional[Mapping[str, str]] = None):
3435
def _normalize_response_status_code(self, response: httpx.Response) -> int:
3536
try:
3637
status_code = response.status_code
37-
if type(status_code) is not int:
38+
if not is_plain_int(status_code):
3839
raise TypeError("status code must be an integer")
3940
normalized_status_code = status_code
4041
if not (

hyperbrowser/transport/sync.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
from hyperbrowser.exceptions import HyperbrowserError
55
from hyperbrowser.header_utils import merge_headers
6+
from hyperbrowser.type_utils import is_plain_int
67
from hyperbrowser.version import __version__
78
from .base import APIResponse, SyncTransportStrategy, _normalize_transport_api_key
89
from .error_utils import (
@@ -33,7 +34,7 @@ def __init__(self, api_key: str, headers: Optional[Mapping[str, str]] = None):
3334
def _normalize_response_status_code(self, response: httpx.Response) -> int:
3435
try:
3536
status_code = response.status_code
36-
if type(status_code) is not int:
37+
if not is_plain_int(status_code):
3738
raise TypeError("status code must be an integer")
3839
normalized_status_code = status_code
3940
if not (

0 commit comments

Comments
 (0)