Add -t/--timeout parameter
This commit is contained in:
parent
268c522c65
commit
30f392c18c
1 changed files with 4 additions and 1 deletions
|
@ -44,6 +44,9 @@ parser.add_argument(
|
||||||
dest="include_rc",
|
dest="include_rc",
|
||||||
help="Allow release candidate (default: only stable release are considered)",
|
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()
|
options = parser.parse_args()
|
||||||
|
|
||||||
|
@ -77,7 +80,7 @@ if not CURRENT:
|
||||||
LATEST = None
|
LATEST = None
|
||||||
try:
|
try:
|
||||||
logging.debug("Get releases RSS feed from %s...", options.url)
|
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)
|
logging.debug("Data retreive:\n%s", r.text)
|
||||||
data = xmltodict.parse(r.text)
|
data = xmltodict.parse(r.text)
|
||||||
for item in data["rss"]["channel"]["item"]:
|
for item in data["rss"]["channel"]["item"]:
|
||||||
|
|
Loading…
Reference in a new issue