3838)
3939from .resources import files , credentials
4040from ._streaming import Stream as Stream , AsyncStream as AsyncStream
41- from ._exceptions import SteelError , APIStatusError
41+ from ._exceptions import APIStatusError
4242from ._base_client import (
4343 DEFAULT_MAX_RETRIES ,
4444 SyncAPIClient ,
@@ -61,7 +61,7 @@ class Steel(SyncAPIClient):
6161 with_streaming_response : SteelWithStreamedResponse
6262
6363 # client options
64- steel_api_key : str
64+ steel_api_key : str | None
6565
6666 def __init__ (
6767 self ,
@@ -92,10 +92,6 @@ def __init__(
9292 """
9393 if steel_api_key is None :
9494 steel_api_key = os .environ .get ("STEEL_API_KEY" )
95- if steel_api_key is None :
96- raise SteelError (
97- "The steel_api_key client option must be set either by passing steel_api_key to the client or by setting the STEEL_API_KEY environment variable"
98- )
9995 self .steel_api_key = steel_api_key
10096
10197 if base_url is None :
@@ -129,6 +125,8 @@ def qs(self) -> Querystring:
129125 @override
130126 def auth_headers (self ) -> dict [str , str ]:
131127 steel_api_key = self .steel_api_key
128+ if steel_api_key is None :
129+ return {}
132130 return {"steel-api-key" : steel_api_key }
133131
134132 @property
@@ -390,7 +388,7 @@ class AsyncSteel(AsyncAPIClient):
390388 with_streaming_response : AsyncSteelWithStreamedResponse
391389
392390 # client options
393- steel_api_key : str
391+ steel_api_key : str | None
394392
395393 def __init__ (
396394 self ,
@@ -421,10 +419,6 @@ def __init__(
421419 """
422420 if steel_api_key is None :
423421 steel_api_key = os .environ .get ("STEEL_API_KEY" )
424- if steel_api_key is None :
425- raise SteelError (
426- "The steel_api_key client option must be set either by passing steel_api_key to the client or by setting the STEEL_API_KEY environment variable"
427- )
428422 self .steel_api_key = steel_api_key
429423
430424 if base_url is None :
@@ -458,6 +452,8 @@ def qs(self) -> Querystring:
458452 @override
459453 def auth_headers (self ) -> dict [str , str ]:
460454 steel_api_key = self .steel_api_key
455+ if steel_api_key is None :
456+ return {}
461457 return {"steel-api-key" : steel_api_key }
462458
463459 @property
0 commit comments