Add -t/--timeout parameter

This commit is contained in:
Benjamin Renard 2023-07-26 00:38:21 +02:00
parent 268c522c65
commit 30f392c18c

View file

@ -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"]: