summaryrefslogtreecommitdiffstats
path: root/libgsmhr/fetch_sources.py
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2018-06-30 16:09:40 +0700
committerHarald Welte <laforge@gnumonks.org>2018-07-03 15:24:37 +0000
commit48e0acdbe670cd1dfd7090fc005509c0b5ef06af (patch)
treed086fed98e41b64394a2134714bb87089110008c /libgsmhr/fetch_sources.py
parent22f84db95dcef03a7c913ce8481c29302f7c824c (diff)
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
Diffstat (limited to 'libgsmhr/fetch_sources.py')
-rwxr-xr-xlibgsmhr/fetch_sources.py7
1 files changed, 6 insertions, 1 deletions
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