Introduction

wx.lib.iewin is an ActiveX wrapper for Internet explorer.

Process Overview

I needed to be able to set an HTTP header and could not readily find the answer on how to do this.

Following a short code snippet on how one can do it.

   1 ...
   2 
   3 self.ie = iewin.IEHtmlWindow(self)
   4 
   5 ...
   6 
   7 # e.g. using HTTP_REFERER header as an example
   8 someHeaders  = "referer: http://www.whateveritmightbe.com\r\nfrom: someone@someserver.com"
   9 self.doURLLoad("http://www.towhoyoumightwantto/whatever.php", someHeaders)
  10 
  11 ...
  12 
  13 def doURLLoad(self, url, headesr=None):
  14    if header == None:
  15        self.ie.Navigate(url)
  16    else:
  17        self.ie.Navigate(url, Headers=headers)

Note the "\r\n" to separate multiple headers.

If you want to set a header like "HTTP_USER_AGENT" then you would need to replace the "_" with "-", e.g. "user-agent: whateveragentvalue".

wx.lib.iewin (last edited 2009-01-23 14:21:42 by lns-bzn-58-82-251-231-103)

NOTE: To edit pages in this wiki you must be a member of the TrustedEditorsGroup.