Is there anything I need to do with the mech_browser attribute to send a
custom User-Agent header with zope.testbrowser.browser.Browser?

  >>> from zope.testbrowser.browser import Browser
  >>> b = Browser()
  >>> b.addHeader('User-Agent', 'Zope Test Browser')
  >>> b.open('http://localhost/')

Apache agent_logs reads: 'Python-urllib/2.5'

Setting the header on the mech_browser, also shows up as
'Python-urllib/2.5':

  >>> b.mech_browser.request.add_header('User-Agent', 'Zope Test Browser')
  >>> b.mech_browser.request.headers
  {'User-agent': 'Zope Test Browser'}
  >>> b.open('http://localhost/')
  >>> b.mech_browser.request.headers
  {}

Thanks,
Jeff


configuration:
non-system python-2.5, virtualenv, easy_install zope.testbrowser

_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users

Reply via email to