Re: print result.text

Alan Jackson <pure_jax-/[email protected]> Fri, 2 Sep 2016 08:23:08 +0000 (UTC)
Newsgroups gmane.comp.java.grinder.user
Message-ID <[email protected]>
--===============5828802201010085459==
Content-Type: multipart/alternative; 
	boundary="----=_Part_4023326_1592766799.1472804588962"
Content-Length: 6829

------=_Part_4023326_1592766799.1472804588962
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Unfortunately not maybe I am going about this the wrong way.
The main aim is to get a response back from a URL however currently even if=
 the DB is unavailable the response code comes back 200 OK


      From: Joan Picanyol i Puig <[email protected]>
 To: [email protected]=20
 Sent: Thursday, September 1, 2016 5:32 PM
 Subject: Re: [Grinder-use] print result.text
  =20
* Alan Jackson <pure_jax-/[email protected]> [20160901 17:11]:
> Hi,
> Can anyone help me write the output of a URL to the out.log file or anoth=
er log file
> Currently I have: -
> # =C2=A0 =C2=A0 =C2=A0 tests[2].POST(searchUrl + sessionCookie,=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 result =3D tests[14].POST('http://cathp60:7002//search-cu=
stomer.do' + sessionCookie,=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ( NVPair('mpn=
', '07935139299'),=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 NVPair('account=
Id', ''),=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 NVPair('contactType', 'U=
ser'), ))=C2=A0 =C2=A0 =C2=A0 =C2=A0 print result.text=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 #WriteToFile(result.text)
> The print result.text will output the result on the command line however =
I need to record this result into the log file.
> I tried WriteToFile(result.text) however this just returned an error.
> Can someone please advise?

Doesn't logging it do what you want?

=C2=A0 =C2=A0 from net.grinder.script.Grinder import grinder
=C2=A0 =C2=A0 grinder.logger.info(result.text)

http://grinder.sourceforge.net/g3/script-gallery.html#helloworld.py

http://grinder.sourceforge.net/g3/logging.html

qvb
--=20
pica

---------------------------------------------------------------------------=
---
_______________________________________________
grinder-use mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/grinder-use

  =20
------=_Part_4023326_1592766799.1472804588962
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<html><head></head><body><div style=3D"color:#000; background-color:#fff; f=
ont-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, =
sans-serif;font-size:13px"><div id=3D"yui_3_16_0_ym19_1_1472762342338_26372=
"><span id=3D"yui_3_16_0_ym19_1_1472762342338_26521">Unfortunately not mayb=
e I am going about this the wrong way.</span></div><div id=3D"yui_3_16_0_ym=
19_1_1472762342338_26372"><span><br></span></div><div id=3D"yui_3_16_0_ym19=
_1_1472762342338_26372"><span id=3D"yui_3_16_0_ym19_1_1472762342338_26522">=
The main aim is to get a response back from a URL however currently even if=
 the DB is unavailable the response code comes back 200 OK</span></div><div=
 id=3D"yui_3_16_0_ym19_1_1472762342338_26372"><br></div><div class=3D"qtdSe=
parateBR"><br><br></div><div class=3D"yahoo_quoted" id=3D"yui_3_16_0_ym19_1=
_1472762342338_26417" style=3D"display: block;">  <div style=3D"font-family=
: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-seri=
f; font-size: 13px;" id=3D"yui_3_16_0_ym19_1_1472762342338_26416"> <div sty=
le=3D"font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida =
Grande, sans-serif; font-size: 16px;" id=3D"yui_3_16_0_ym19_1_1472762342338=
_26415"> <div dir=3D"ltr" id=3D"yui_3_16_0_ym19_1_1472762342338_26414"> <fo=
nt size=3D"2" face=3D"Arial" id=3D"yui_3_16_0_ym19_1_1472762342338_26413"> =
<hr size=3D"1" id=3D"yui_3_16_0_ym19_1_1472762342338_26412"> <b><span style=
=3D"font-weight:bold;">From:</span></b> Joan Picanyol i Puig &lt;lists-grin=
[email protected]&gt;<br> <b><span style=3D"font-weight: bold;">To:</span></b> =
[email protected] <br> <b><span style=3D"font-weight: bold;=
">Sent:</span></b> Thursday, September 1, 2016 5:32 PM<br> <b><span style=
=3D"font-weight: bold;">Subject:</span></b> Re: [Grinder-use] print result.=
text<br> </font> </div> <div class=3D"y_msg_container" id=3D"yui_3_16_0_ym1=
9_1_1472762342338_26418"><br>* Alan Jackson &lt;<a shape=3D"rect" ymailto=
=3D"mailto:pure_jax-/[email protected]" href=3D"mailto:pure_jax-/[email protected]" id=3D"yui=
_3_16_0_ym19_1_1472762342338_26540">pure_jax-/[email protected]</a>&gt; [20160901 17=
:11]:<div class=3D"yqt7101044159" id=3D"yqtfd00013"><br clear=3D"none">&gt;=
 Hi,<br clear=3D"none">&gt; Can anyone help me write the output of a URL to=
 the out.log file or another log file<br clear=3D"none">&gt; Currently I ha=
ve: -<br clear=3D"none">&gt; # &nbsp; &nbsp; &nbsp; tests[2].POST(searchUrl=
 + sessionCookie,&nbsp; &nbsp; &nbsp; &nbsp; result =3D tests[14].POST('<a =
shape=3D"rect" href=3D"http://cathp60:7002//search-customer.do'" target=3D"=
_blank">http://cathp60:7002//search-customer.do' </a>+ sessionCookie,&nbsp;=
 &nbsp; &nbsp; &nbsp; &nbsp; ( NVPair('mpn', '07935139299'),&nbsp; &nbsp; &=
nbsp; &nbsp; &nbsp; &nbsp; NVPair('accountId', ''),&nbsp; &nbsp; &nbsp; &nb=
sp; &nbsp; &nbsp; NVPair('contactType', 'User'), ))&nbsp; &nbsp; &nbsp; &nb=
sp; print result.text&nbsp; &nbsp; &nbsp; &nbsp; #WriteToFile(result.text)<=
br clear=3D"none">&gt; The print result.text will output the result on the =
command line however I need to record this result into the log file.<br cle=
ar=3D"none">&gt; I tried WriteToFile(result.text) however this just returne=
d an error.<br clear=3D"none">&gt; Can someone please advise?</div><br clea=
r=3D"none"><br clear=3D"none">Doesn't logging it do what you want?<br clear=
=3D"none"><br clear=3D"none">&nbsp; &nbsp; from net.grinder.script.Grinder =
import grinder<br clear=3D"none">&nbsp; &nbsp; grinder.logger.info(result.t=
ext)<br clear=3D"none"><br clear=3D"none"><a shape=3D"rect" href=3D"http://=
grinder.sourceforge.net/g3/script-gallery.html#helloworld.py" target=3D"_bl=
ank">http://grinder.sourceforge.net/g3/script-gallery.html#helloworld.py</a=
><br clear=3D"none"><br clear=3D"none"><a shape=3D"rect" href=3D"http://gri=
nder.sourceforge.net/g3/logging.html" target=3D"_blank">http://grinder.sour=
ceforge.net/g3/logging.html</a><br clear=3D"none"><br clear=3D"none">qvb<br=
 clear=3D"none">-- <br clear=3D"none">pica<br clear=3D"none"><br clear=3D"n=
one">----------------------------------------------------------------------=
--------<br clear=3D"none">_______________________________________________<=
br clear=3D"none">grinder-use mailing list<br clear=3D"none"><a shape=3D"re=
ct" ymailto=3D"mailto:[email protected]" href=3D"mailto:gri=
[email protected]">[email protected]</a><br cl=
ear=3D"none"><a shape=3D"rect" href=3D"https://lists.sourceforge.net/lists/=
listinfo/grinder-use" target=3D"_blank">https://lists.sourceforge.net/lists=
/listinfo/grinder-use</a><br><br></div> </div> </div>  </div></div></body><=
/html>
------=_Part_4023326_1592766799.1472804588962--


--===============5828802201010085459==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------

--===============5828802201010085459==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
grinder-use mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/grinder-use

--===============5828802201010085459==--