@@ -311,7 +311,7 @@ def _get_project_for_url_or_path( # pylint: disable=too-many-arguments
311
311
custom_template_path : Optional [Path ] = None ,
312
312
file_encoding : str = "utf-8" ,
313
313
) -> 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 )
315
315
if isinstance (data_dict , GeneratorError ):
316
316
return data_dict
317
317
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
395
395
return GeneratorError (header = f"Invalid YAML from provided source: { err } " )
396
396
397
397
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 ]:
399
399
yaml_bytes : bytes
400
400
content_type : Optional [str ]
401
401
if url is not None and path is not None :
402
402
return GeneratorError (header = "Provide URL or Path, not both." )
403
403
if url is not None :
404
404
try :
405
- response = httpx .get (url )
405
+ response = httpx .get (url , timeout = timeout )
406
406
yaml_bytes = response .content
407
407
if "content-type" in response .headers :
408
408
content_type = response .headers ["content-type" ].split (";" )[0 ]
0 commit comments