[game-data-packager] 09/11: use custom user agent (#784957)

Alexandre Detiste detiste-guest at moszumanska.debian.org
Fri Jun 5 07:57:21 UTC 2015


This is an automated email from the git hooks/post-receive script.

detiste-guest pushed a commit to branch master
in repository game-data-packager.

commit f2b2f77641c39eda1f92550db6ebca9a6292272a
Author: Alexandre Detiste <alexandre.detiste at gmail.com>
Date:   Thu Jun 4 13:51:23 2015 +0200

    use custom user agent (#784957)
---
 debian/changelog               | 1 +
 game_data_packager/__init__.py | 7 ++++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index c9be53e..f384ca1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -13,6 +13,7 @@ game-data-packager (42) UNRELEASED; urgency=medium
   * add support for Compet-N PWAD's (Closes: #776061)
   * only load actually needed YAML files (Closes: #779937)
   * improve 'GDP $game --help' (Closes: #784563)
+  * use custom HTTP User-Agent (Closes: #784957)
 
  -- Simon McVittie <smcv at debian.org>  Sun, 03 May 2015 14:34:00 +0200
 
diff --git a/game_data_packager/__init__.py b/game_data_packager/__init__.py
index b3b2d7a..c3a1a95 100644
--- a/game_data_packager/__init__.py
+++ b/game_data_packager/__init__.py
@@ -56,6 +56,10 @@ from .util import (MEBIBYTE,
         which)
 from .version import GAME_PACKAGE_VERSION
 
+AGENT = ('Debian Game-Data-Packager/%s (%s %s;'
+         ' +http://wiki.debian.org/Games/GameDataPackager)' %
+        (GAME_PACKAGE_VERSION, os.uname()[0], os.uname()[4]) )
+
 logging.basicConfig()
 logger = logging.getLogger('game-data-packager')
 
@@ -1442,7 +1446,8 @@ class GameData(object):
                     tmp = None
 
                     try:
-                        rf = urllib.request.urlopen(url)
+                        rf = urllib.request.urlopen(urllib.request.Request(
+                                         url,headers={'User-Agent': AGENT}))
                         if rf is None:
                             continue
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/game-data-packager.git



More information about the Pkg-games-commits mailing list