From 113c39d57726970141348296133eaa96d6084ff6 Mon Sep 17 00:00:00 2001 From: Mike Hiretsky Date: Tue, 8 Sep 2020 15:30:19 +0300 Subject: [PATCH] Add User-Agent for request to binhosts. This is workaround for some AntiDDOS system, without User-Agent they send HTTP403. --- pym/calculate/lib/utils/binhosts.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pym/calculate/lib/utils/binhosts.py b/pym/calculate/lib/utils/binhosts.py index aa6d44c..814a0e7 100644 --- a/pym/calculate/lib/utils/binhosts.py +++ b/pym/calculate/lib/utils/binhosts.py @@ -45,6 +45,7 @@ def _urlopen(fn, timeout=None): """ proxy_handler = urllib2.ProxyHandler({}) opener = urllib2.build_opener(proxy_handler) + opener.addheaders = [('User-Agent', 'Calculate Linux')] if timeout is not None: f = opener.open(fn, timeout=timeout) else: