From e0fcc1ffc89baeb5ddba4250612c36850fd022c5 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Sun, 6 Jul 2014 05:04:43 +0400 Subject: [PATCH] Minor refactoring --- Robots/bkmk_rurllib.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Robots/bkmk_rurllib.py b/Robots/bkmk_rurllib.py index f39a02c..9acbd88 100644 --- a/Robots/bkmk_rurllib.py +++ b/Robots/bkmk_rurllib.py @@ -54,17 +54,17 @@ class MyURLopener(urllib.URLopener): urllib._urlopener = MyURLopener() # Fake headers to pretend this is a real browser -_version = "Mozilla/5.0 (X11; U; Linux 2.6 i686; en) Gecko/20001221 Firefox/2.0.0" -urllib._urlopener.addheaders[0] = ('User-Agent', _version) -_version = "bookmarks_db (Python %d.%d.%d; urllib/%s)" % ( +_user_agent = "Mozilla/5.0 (X11; U; Linux 2.6 i686; en) Gecko/20001221 Firefox/2.0.0" +urllib._urlopener.addheaders[0] = ('User-Agent', _user_agent) +_x_user_agent = "bookmarks_db (Python %d.%d.%d; urllib/%s)" % ( sys.version_info[0], sys.version_info[1], sys.version_info[2], urllib.__version__) -urllib._urlopener.addheader('X-User-Agent', _version) +urllib._urlopener.addheader('X-User-Agent', _x_user_agent) urllib._urlopener.addheader('Referer', '') -urllib._urlopener.addheader('Connection', 'close') urllib._urlopener.addheader('Accept', '*/*') urllib._urlopener.addheader('Accept-Language', 'ru,en') urllib._urlopener.addheader('Cache-Control', 'max-age=300') +urllib._urlopener.addheader('Connection', 'close') urllib_ftpwrapper = urllib.ftpwrapper -- 2.39.5