From 48e0acdbe670cd1dfd7090fc005509c0b5ef06af Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Sat, 30 Jun 2018 16:09:40 +0700 Subject: [PATCH] libgsmhr/fetch_sources.py: fix source code downloading For some reason, the 3GPP server started to reject the source code download request: urllib2.HTTPError: HTTP Error 403: Forbidden Adding both 'User-Agent' and 'Accept' headers solves the problem. Change-Id: I8afd39c85dd3e450c5355888ab6edcf4c81f8b87 --- libgsmhr/fetch_sources.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libgsmhr/fetch_sources.py b/libgsmhr/fetch_sources.py index a65fff2..6fb1b8e 100755 --- a/libgsmhr/fetch_sources.py +++ b/libgsmhr/fetch_sources.py @@ -12,6 +12,10 @@ except: SRC = "http://www.3gpp.org/ftp/Specs/archive/06_series/06.06/0606-421.zip" +HDR = { + "User-Agent": "Mozilla/5.0 (X11; ArchLinux; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0", + "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", +} def get_zipfile(data): @@ -45,7 +49,8 @@ def main(*args): os.chdir(tgt) # Get the original data - u = urllib2.urlopen(SRC) + req = urllib2.Request(SRC, headers = HDR) + u = urllib2.urlopen(req) d = u.read() # Get DISK.zip