Detecting Browsers in Python
Jay O'Connor
joconnor at cybermesa.com
Tue Nov 18 11:21:25 EST 2003
Daniel Orner wrote:
>Does anyone know of a simple way to have a Python script find out what
>browser is accessing it? After a web search the only thing I found to
>do this is Zope, but the system I'm programming doesn't use Zope and
>I'm not really interested in installing it just for this minor detail.
>Is there another way?
>
>Thanks!
>
>--Daniel Orner
>
>
Going purely from memory, "USER-AGENT" or something similar entry in the
os.environ dictionary will have a string identifying the browser. It's
only partially reliable because some browsers will pretend to be another
browser and some, I think, will allow the user to specify what they want
to pretend to be.
Anyway, play around with it and see if will give you what you need
Take care,
Jay
More information about the Python-list
mailing list