From 30f392c18c2911b65224fb72fad28c2341ffb02f Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Wed, 26 Jul 2023 00:38:21 +0200 Subject: [PATCH] Add -t/--timeout parameter --- check_forgejo_upgrade | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/check_forgejo_upgrade b/check_forgejo_upgrade index fd78a23..3483d13 100755 --- a/check_forgejo_upgrade +++ b/check_forgejo_upgrade @@ -44,6 +44,9 @@ parser.add_argument( dest="include_rc", help="Allow release candidate (default: only stable release are considered)", ) +parser.add_argument( + "-t", "--timeout", type=int, help="Specify timeout for HTTP requests (default: 20)", default=20 +) options = parser.parse_args() @@ -77,7 +80,7 @@ if not CURRENT: LATEST = None try: logging.debug("Get releases RSS feed from %s...", options.url) - r = requests.get(options.url) + r = requests.get(options.url, timeout=options.timeout) logging.debug("Data retreive:\n%s", r.text) data = xmltodict.parse(r.text) for item in data["rss"]["channel"]["item"]: