From: Oleg Broytman Date: Sun, 6 Jul 2014 01:04:43 +0000 (+0400) Subject: Minor refactoring X-Git-Tag: v4.6.0~9 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=e0fcc1ffc89baeb5ddba4250612c36850fd022c5;p=bookmarks_db.git Minor refactoring --- 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