aboutsummaryrefslogtreecommitdiff
path: root/ghwt.py
diff options
context:
space:
mode:
authorAndrei Antonov <polymorphm@gmail.com>2018-08-26 20:37:49 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2018-08-27 00:55:45 +0300
commit8f7781f1d6bf36c064b39e7d0794c686f1b78665 (patch)
tree892219ca1dce71083a764ab3a885241b20d3a36e /ghwt.py
parentf34f0717e00756ea786ac62b3126d3425fcd6649 (diff)
downloadmeson-8f7781f1d6bf36c064b39e7d0794c686f1b78665.zip
meson-8f7781f1d6bf36c064b39e7d0794c686f1b78665.tar.gz
meson-8f7781f1d6bf36c064b39e7d0794c686f1b78665.tar.bz2
using urlopen() with explicit timeout
Diffstat (limited to 'ghwt.py')
-rwxr-xr-xghwt.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/ghwt.py b/ghwt.py
index 32db4be..cc79ce7 100755
--- a/ghwt.py
+++ b/ghwt.py
@@ -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()