Change in gapk[master]: libgsmhr/fetch_sources.py: fix source code downloading

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Vadim Yanitskiy gerrit-no-reply at lists.osmocom.org
Sat Jun 30 14:23:17 UTC 2018


Vadim Yanitskiy has uploaded this change for review. ( https://gerrit.osmocom.org/9792


Change subject: libgsmhr/fetch_sources.py: fix source code downloading
......................................................................

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
---
M libgsmhr/fetch_sources.py
1 file changed, 6 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/gapk refs/changes/92/9792/1

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 @@
 
 
 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 @@
 	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

-- 
To view, visit https://gerrit.osmocom.org/9792
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: gapk
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8afd39c85dd3e450c5355888ab6edcf4c81f8b87
Gerrit-Change-Number: 9792
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180630/6cc70ba8/attachment.htm>


More information about the gerrit-log mailing list