From c9533828e7940c51cb1d0f9fd59dcbb41900808a Mon Sep 17 00:00:00 2001 From: David Perez-Suarez Date: Mon, 28 Sep 2020 18:53:17 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20403=20error=20for=20query?= =?UTF-8?q?=20without=20user=20agent?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/bin/shellshare | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/public/bin/shellshare b/public/bin/shellshare index 2609ebe..e4038b4 100755 --- a/public/bin/shellshare +++ b/public/bin/shellshare @@ -38,8 +38,11 @@ except NameError: if platform.system() == 'Windows': try: import urllib.request as url_req # for Python 3 + opener = url_req.URLopener() + opener.addheader('User-Agent', 'shellshare') except ImportError: import urllib as url_req # for Python 2 + opener = None class NotAuthorizedException(Exception): pass @@ -182,7 +185,10 @@ if platform.system() == 'Windows': ) if should_download.lower() not in {'', 'y', 'yes'}: exit(0) - url_req.urlretrieve(script_url, script_path) + if opener: + opener.retrieve(script_url, script_path) + else: + url_req.urlretrieve(script_url, script_path) else: # Use OS version of script script_path = 'script'