@@ -311,7 +311,7 @@ def _get_project_for_url_or_path( # pylint: disable=too-many-arguments
311311 custom_template_path : Optional [Path ] = None ,
312312 file_encoding : str = "utf-8" ,
313313) -> Union [Project , GeneratorError ]:
314- data_dict = _get_document (url = url , path = path )
314+ data_dict = _get_document (url = url , path = path , timeout = config . http_timeout )
315315 if isinstance (data_dict , GeneratorError ):
316316 return data_dict
317317 openapi = GeneratorData .from_dict (data_dict , config = config )
@@ -395,14 +395,14 @@ def _load_yaml_or_json(data: bytes, content_type: Optional[str]) -> Union[Dict[s
395395 return GeneratorError (header = f"Invalid YAML from provided source: { err } " )
396396
397397
398- def _get_document (* , url : Optional [str ], path : Optional [Path ]) -> Union [Dict [str , Any ], GeneratorError ]:
398+ def _get_document (* , url : Optional [str ], path : Optional [Path ], timeout : int ) -> Union [Dict [str , Any ], GeneratorError ]:
399399 yaml_bytes : bytes
400400 content_type : Optional [str ]
401401 if url is not None and path is not None :
402402 return GeneratorError (header = "Provide URL or Path, not both." )
403403 if url is not None :
404404 try :
405- response = httpx .get (url )
405+ response = httpx .get (url , timeout = timeout )
406406 yaml_bytes = response .content
407407 if "content-type" in response .headers :
408408 content_type = response .headers ["content-type" ].split (";" )[0 ]
0 commit comments