[ptt-users] Setting User-Agent
Chi Tong
chictong at yahoo.com
Mon Jun 4 15:35:09 PDT 2007
Hi,
I need to set the User-Agent in the http header to the
specific string such as 'Mozilla/5.0 (Windows; U;
Windows NT 5.1; en-US; rv:1.8.0.12) Gecko/20070508
Firefox/1.5.0.12'.
I tried to do it in the test script setUp() by adding,
def setUp( self ):
....
self.header = ProtocolHandler.getHeader(
'http' )
self.header.set('User-Agent' , 'Mozilla/5.0
(Windows; U; Windows NT 5.1; en-US; rv:1.8.0.12)
Gecko/20070508 Firefox/1.5.0.12')
During the execution of the test script, the default
User-Agent, 'Mozilla/4.0 (compatible; MSIE 6.0;
Windows NT 5.1; SV1; Maxthon)', in the agentbase.py
was used instead by the http get/post methods.
Is there any way/method to override the default
User-Agent (or some other header fields) in the http
header for the http get/post methods during test
script execution?
I tried to modify the self.useragent value directly in
the agentbase.py right now for the User-Agent I need.
Thanks,
ct
____________________________________________________________________________________
Need a vacation? Get great deals
to amazing places on Yahoo! Travel.
http://travel.yahoo.com/
More information about the Users
mailing list