From: Cameron Dale Date: Sun, 16 Dec 2007 03:24:01 +0000 (-0800) Subject: Add proper version numbers to the user-agent string. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b4bc2eadd3c98eb10f70ec7f67d97819f955ae8f;p=quix0rs-apt-p2p.git Add proper version numbers to the user-agent string. --- diff --git a/HTTPDownloader.py b/HTTPDownloader.py index 140aace..7e5a06c 100644 --- a/HTTPDownloader.py +++ b/HTTPDownloader.py @@ -1,11 +1,15 @@ from twisted.internet import reactor, defer, protocol from twisted.internet.protocol import ClientFactory +from twisted import version as twisted_version from twisted.web2.client.interfaces import IHTTPClientManager from twisted.web2.client.http import ProtocolError, ClientRequest, HTTPClientProtocol +from twisted.web2 import stream as stream_mod, http_headers +from twisted.web2 import version as web2_version from twisted.trial import unittest from zope.interface import implements -from twisted.web2 import stream as stream_mod, http_headers + +from apt_dht_conf import version class HTTPClientManager(ClientFactory): """A manager for all HTTP requests to a single site. @@ -108,7 +112,8 @@ class HTTPClientManager(ClientFactory): def setCommonHeaders(self): headers = http_headers.Headers() headers.setHeader('Host', self.host) - headers.setHeader('User-Agent', 'apt-dht/0.0.0 (twisted.web2 0.2.0+svn20070403)') + headers.setHeader('User-Agent', 'apt-dht/%s (twisted/%s twisted.web2/%s)' % + (version.short(), twisted_version.short(), web2_version.short())) return headers def get(self, path, method="GET"):