11from dataclasses import dataclass
2- from typing import Dict , Optional
2+ from typing import Dict , Mapping , Optional
33import os
44
55from .exceptions import HyperbrowserError
@@ -18,8 +18,8 @@ def __post_init__(self) -> None:
1818 raise HyperbrowserError ("api_key must be a string" )
1919 if not isinstance (self .base_url , str ):
2020 raise HyperbrowserError ("base_url must be a string" )
21- if self .headers is not None and not isinstance (self .headers , dict ):
22- raise HyperbrowserError ("headers must be a dictionary of string pairs" )
21+ if self .headers is not None and not isinstance (self .headers , Mapping ):
22+ raise HyperbrowserError ("headers must be a mapping of string pairs" )
2323 self .api_key = self .api_key .strip ()
2424 if not self .api_key :
2525 raise HyperbrowserError ("api_key must not be empty" )
@@ -34,9 +34,7 @@ def __post_init__(self) -> None:
3434 normalized_headers : Dict [str , str ] = {}
3535 for key , value in self .headers .items ():
3636 if not isinstance (key , str ) or not isinstance (value , str ):
37- raise HyperbrowserError (
38- "headers must be a dictionary of string pairs"
39- )
37+ raise HyperbrowserError ("headers must be a mapping of string pairs" )
4038 normalized_headers [key ] = value
4139 self .headers = normalized_headers
4240
0 commit comments