File tree 2 files changed +13
-1
lines changed
2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,9 @@ def get_parser(with_examples: bool = False) -> ArgumentParser:
73
73
parser .add_argument (
74
74
"-H" , "--headers" , nargs = "*" , help = "http headers in the form key:value"
75
75
)
76
+ parser .add_argument (
77
+ "--timeout" , type = int , default = None , help = "Timeout in seconds for the request."
78
+ )
76
79
parser .add_argument ("--version" , action = "version" , version = f"v{ __version__ } " )
77
80
group = parser .add_mutually_exclusive_group ()
78
81
group .add_argument (
@@ -367,7 +370,9 @@ async def main(args: Namespace) -> int:
367
370
368
371
# Connect to the backend and provide a session
369
372
async with Client (
370
- transport = transport , fetch_schema_from_transport = args .print_schema
373
+ transport = transport ,
374
+ fetch_schema_from_transport = args .print_schema ,
375
+ execute_timeout = args .timeout ,
371
376
) as session :
372
377
373
378
if args .print_schema :
Original file line number Diff line number Diff line change @@ -56,6 +56,13 @@ def test_cli_parser(parser):
56
56
assert args .server == "https://your_server.com"
57
57
assert args .headers == ["Authorization:Bearer blahblah" ]
58
58
59
+ # Call with timeout parameter
60
+ # gql-cli https://your_server.com --timeout 60
61
+ args = parser .parse_args (["https://your_server.com" , "--timeout" , "60" ])
62
+
63
+ assert args .server == "https://your_server.com"
64
+ assert args .timeout == 60
65
+
59
66
# Check loglevel flags
60
67
# gql-cli https://your_server.com --debug
61
68
args = parser .parse_args (["https://your_server.com" , "--debug" ])
You can’t perform that action at this time.
0 commit comments