From dbe90d28824cf85512f4c239b7ebc940194a16cc Mon Sep 17 00:00:00 2001 From: John Garland Date: Mon, 26 Oct 2009 13:58:42 +0000 Subject: [PATCH] Use custom user-agent when downloading files with httpdownloader. --- deluge/httpdownloader.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/deluge/httpdownloader.py b/deluge/httpdownloader.py index 47d18f26c..9dd5dbbba 100644 --- a/deluge/httpdownloader.py +++ b/deluge/httpdownloader.py @@ -36,6 +36,7 @@ from twisted.web import client, http from twisted.web.error import PageRedirect from twisted.python.failure import Failure from twisted.internet import reactor +from common import get_version class HTTPDownloader(client.HTTPDownloader): """ @@ -56,7 +57,8 @@ class HTTPDownloader(client.HTTPDownloader): self.__part_callback = part_callback self.current_length = 0 self.value = filename - client.HTTPDownloader.__init__(self, url, filename, headers=headers) + agent = "Deluge/%s (http://deluge-torrent.org)" % get_version() + client.HTTPDownloader.__init__(self, url, filename, headers=headers, agent=agent) def gotStatus(self, version, status, message): self.code = int(status)