[Yum] Re: Only cosmetics: http referrer?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



--DSayHWYpDlRfCAAQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, Jun 19, 2003 at 02:19:42AM +0200, Axel Thimm wrote:
> Axel Thimm wrote:
> > looking at my stats I see yum come up as "Python-urllib/2.0a1", would y=
ou like
> > to change that to something like yum/someversionhere?
>=20
> Here is a small patch, that changes the User-Agent to "Yum/1.98". It
> wasn't as trivial as I hoped it were, but the result is quite compact
> and comprehendable.
>=20
> This is my first python code, treat with care ;)

--- yum-1.98/urlgrabber.py.agent	2003-06-01 05:33:33.000000000 +0200
+++ yum-1.98/urlgrabber.py	2003-06-17 22:24:52.000000000 +0200
@@ -15,6 +15,16 @@
     import urllib
     urllib2 =3D urllib
=20
+class MyOpenerDirector(urllib2.OpenerDirector):
+    def __init__(self):
+        self.addheaders =3D [('User-agent', "Yum/1.98")]
+        # manage the individual handlers
+        self.handlers =3D []
+        self.handle_open =3D {}
+        self.handle_error =3D {}
+
+urllib2.OpenerDirector =3D MyOpenerDirector
+
 try:
     from httplib import HTTPException
 except ImportError, msg:


--=20
Axel.Thimm@xxxxxxxxxxxxxxxxxxx

--DSayHWYpDlRfCAAQ
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE+8QIZQBVS1GOamfERAotBAJ4z9evWi/YdwhctVSsI9AwvsESrqACeLWff
UVl3F8chRq7JQUi2VfLUBac=
=+Ewm
-----END PGP SIGNATURE-----

--DSayHWYpDlRfCAAQ--


[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux