Use custom user-agent when downloading files with httpdownloader.

This commit is contained in:
John Garland 2009-10-26 13:58:42 +00:00
parent 3153a545ca
commit dbe90d2882
1 changed files with 3 additions and 1 deletions

View File

@ -36,6 +36,7 @@ from twisted.web import client, http
from twisted.web.error import PageRedirect from twisted.web.error import PageRedirect
from twisted.python.failure import Failure from twisted.python.failure import Failure
from twisted.internet import reactor from twisted.internet import reactor
from common import get_version
class HTTPDownloader(client.HTTPDownloader): class HTTPDownloader(client.HTTPDownloader):
""" """
@ -56,7 +57,8 @@ class HTTPDownloader(client.HTTPDownloader):
self.__part_callback = part_callback self.__part_callback = part_callback
self.current_length = 0 self.current_length = 0
self.value = filename 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): def gotStatus(self, version, status, message):
self.code = int(status) self.code = int(status)