Passing environment variable to HTTP server

Doug Fort dougfort at downright.com
Tue May 8 20:36:11 EDT 2001


William Park wrote:

> When I send a request to CGI script, the browser sends environment
> variables, such as HTTP_REFERER, HTTP_USER_AGENT, etc.  How can I modify
> the environment variables that are sent to CGI script?
> 
> Eg. if remote CGI script only responds to Netscape (from
> HTTP_USER_AGENT), but I would still like to browse and download using
> Python script.
> 
> --William Park, Open Geometry Consulting, Mississauga, Ontario, Canada.
>   8 CPU cluster, (Slackware) Linux, Python, LaTeX, vim, mutt
> 
> 

To impersonate a browser we send the 'User-agent' header.  However there's 
usually more to it than that: other custom headers or specialized cookies.  
I recommend capturing a browser session with Ethereal 
http://www.ethereal.com/ and duplicating the headers exactly.

Note that even if you are impersonating a browsee, you should adhere to the 
site's robot.txt file and <meta> tags.  There is an excellent Python 
module for checking robots.txt.

-- 
Doug Fort <dougfort at downright.com>
Senior Meat Manager
Downright Software LLC

______________________________________________________________________
Posted Via Uncensored-News.Com - Still Only $9.95 - http://www.uncensored-news.com
   With Seven Servers In California And Texas - The Worlds Uncensored News Source
  



More information about the Python-list mailing list