diff options
author | Andrei Antonov <polymorphm@gmail.com> | 2018-08-26 20:37:49 +0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2018-08-27 00:55:45 +0300 |
commit | 8f7781f1d6bf36c064b39e7d0794c686f1b78665 (patch) | |
tree | 892219ca1dce71083a764ab3a885241b20d3a36e /ghwt.py | |
parent | f34f0717e00756ea786ac62b3126d3425fcd6649 (diff) | |
download | meson-8f7781f1d6bf36c064b39e7d0794c686f1b78665.zip meson-8f7781f1d6bf36c064b39e7d0794c686f1b78665.tar.gz meson-8f7781f1d6bf36c064b39e7d0794c686f1b78665.tar.bz2 |
using urlopen() with explicit timeout
Diffstat (limited to 'ghwt.py')
-rwxr-xr-x | ghwt.py | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -22,10 +22,11 @@ import urllib.request, json, sys, os, shutil, subprocess import configparser, hashlib +req_timeout = 600.0 private_repos = {'meson', 'wrapweb', 'meson-ci'} def gh_get(url): - r = urllib.request.urlopen(url) + r = urllib.request.urlopen(url, timeout=req_timeout) jd = json.loads(r.read().decode('utf-8')) return jd @@ -45,7 +46,7 @@ def unpack(sproj, branch, outdir): config = configparser.ConfigParser() config.read(usfile) us_url = config['wrap-file']['source_url'] - us = urllib.request.urlopen(us_url).read() + us = urllib.request.urlopen(us_url, timeout=req_timeout).read() h = hashlib.sha256() h.update(us) dig = h.hexdigest() |