os module

Tim Chase python.list at tim.thechases.com
Mon Mar 2 06:16:58 EST 2009


> Its just http, I am using pylons. Right now I am doing tht
> with extra parameter. But even if I get to know about the
> platform of the client machine, I need to use the other
> properties of the corresponding machine's os module.

HTTP doesn't require the client browser to send any such 
information to you, so there's no way you can be sure to get it.

The User-Agent header _may_ include some sort of platform 
information[1].  However, it may omit this information, or the 
user can change it so it downright lies[2].

Therefore, unless you control the application running on the 
client end (possible within a corporate environment, or if you're 
running a rich client that just happens to use HTTP as its 
communication transport; wherein your user-agent app on the 
client side can send "X-*" extended headers that your server can 
parse), you're at the mercy of your user to give you information 
that you need/want.  Compounding this problem, even *with* 
benevolent user-agent strings, it won't include other 
sys/os-module type information such the $PATH.

I'd suggest reading up on HTTP[3] so you know what is and isn't 
included in the protocol so you can set your expectations 
according to its limitations.

-tkc


[1]
http://www.zytrax.com/tech/web/browser_ids.htm

[2]

https://addons.mozilla.org/en-US/firefox/addon/59

[3]
http://www.ietf.org/rfc/rfc2616.txt







More information about the Python-list mailing list