librelist archives

« back to archive

capturing the responses from page

capturing the responses from page

From:
jamal sasha
Date:
2013-02-07 @ 07:59
hi,

   I can see that every interaction I generate on the page is captured on
the terminal.. is there a way I can "capture" these responses.
Is it possible if I write a socket program which acts as a client and
listens to the same host and port, I can maybe capture these responses??
or is there any simpler way.

Re: [flask] capturing the responses from page

From:
Jesaja Everling
Date:
2013-02-07 @ 08:38
Hi Jamal,

Logging is probably what you are looking for:
http://flask.pocoo.org/docs/errorhandling/#error-mails
Flask already uses a logger to display the messages in the terminal,
you can register additional handlers for this logger. A Filehandler
should let you capture those responses into a file. I think the
messages you see on the Terminal will only be emitted when a handler
is registered with the level DEBUG.
Just look at the example in the docs for the SMTPHandler, and adjust
it to use a [Rotating]FileHandler.

Best Regards,

Jesaja Everling


On Thu, Feb 7, 2013 at 8:59 AM, jamal sasha <jamalshasha@gmail.com> wrote:
> hi,
>
>    I can see that every interaction I generate on the page is captured on
> the terminal.. is there a way I can "capture" these responses.
> Is it possible if I write a socket program which acts as a client and
> listens to the same host and port, I can maybe capture these responses??
> or is there any simpler way.
>

Re: [flask] capturing the responses from page

From:
jamal sasha
Date:
2013-02-08 @ 00:33
Hi...

   So here is what I am trying to do...From the page.. the user will
essentially fill a form... (few check boxes..)

Now.. after that user presesses submit.. I have another python script
waiting to get all this information to be processed accordingly..

lets say..

def user_pressed():
      responses = the_user_has_asked_for()


Now.. how do i connect this python code with the flask app ??
Any suggestions?
Thanks





On Thu, Feb 7, 2013 at 12:38 AM, Jesaja Everling <jeverling@gmail.com>wrote:

> Hi Jamal,
>
> Logging is probably what you are looking for:
> http://flask.pocoo.org/docs/errorhandling/#error-mails
> Flask already uses a logger to display the messages in the terminal,
> you can register additional handlers for this logger. A Filehandler
> should let you capture those responses into a file. I think the
> messages you see on the Terminal will only be emitted when a handler
> is registered with the level DEBUG.
> Just look at the example in the docs for the SMTPHandler, and adjust
> it to use a [Rotating]FileHandler.
>
> Best Regards,
>
> Jesaja Everling
>
>
> On Thu, Feb 7, 2013 at 8:59 AM, jamal sasha <jamalshasha@gmail.com> wrote:
> > hi,
> >
> >    I can see that every interaction I generate on the page is captured on
> > the terminal.. is there a way I can "capture" these responses.
> > Is it possible if I write a socket program which acts as a client and
> > listens to the same host and port, I can maybe capture these responses??
> > or is there any simpler way.
> >
>

Re: [flask] capturing the responses from page

From:
jamal sasha
Date:
2013-02-08 @ 01:30
Sorry for sending so many emails..

I was going thru the documentation... seems like I need to make forms using
wtforms??
http://flask.pocoo.org/docs/patterns/wtforms/

So, my html code is like this:
<div class="checksheet">

    <input id="XML Parser" class="checkbox" type="checkbox"/>XML Parser
    <input id="Feed Parser" class="checkbox" type="checkbox"/>Feed Parser
    <input id="Text Parser" class="checkbox" type="checkbox"/>Text Parser
    <input id="Case Normalization" class="checkbox" type="checkbox"/>Case
Normalization
    <input id="Stemmer" class="checkbox" type="checkbox"/>  Stemmer

</div>

<div class="submit"><input type="submit"  value="Submit"></div>


On submit what I want is that I capture all the checkboxes that user has
selected?
If I can some input.. I would really appreciate it..
Thanks..


On Thu, Feb 7, 2013 at 4:33 PM, jamal sasha <jamalshasha@gmail.com> wrote:

> Hi...
>
>    So here is what I am trying to do...From the page.. the user will
> essentially fill a form... (few check boxes..)
>
> Now.. after that user presesses submit.. I have another python script
> waiting to get all this information to be processed accordingly..
>
> lets say..
>
> def user_pressed():
>       responses = the_user_has_asked_for()
>
>
> Now.. how do i connect this python code with the flask app ??
> Any suggestions?
> Thanks
>
>
>
>
>
> On Thu, Feb 7, 2013 at 12:38 AM, Jesaja Everling <jeverling@gmail.com>wrote:
>
>> Hi Jamal,
>>
>> Logging is probably what you are looking for:
>> http://flask.pocoo.org/docs/errorhandling/#error-mails
>> Flask already uses a logger to display the messages in the terminal,
>> you can register additional handlers for this logger. A Filehandler
>> should let you capture those responses into a file. I think the
>> messages you see on the Terminal will only be emitted when a handler
>> is registered with the level DEBUG.
>> Just look at the example in the docs for the SMTPHandler, and adjust
>> it to use a [Rotating]FileHandler.
>>
>> Best Regards,
>>
>> Jesaja Everling
>>
>>
>> On Thu, Feb 7, 2013 at 8:59 AM, jamal sasha <jamalshasha@gmail.com>
>> wrote:
>> > hi,
>> >
>> >    I can see that every interaction I generate on the page is captured
>> on
>> > the terminal.. is there a way I can "capture" these responses.
>> > Is it possible if I write a socket program which acts as a client and
>> > listens to the same host and port, I can maybe capture these responses??
>> > or is there any simpler way.
>> >
>>
>
>

Re: [flask] capturing the responses from page

From:
David Brenneman
Date:
2013-02-08 @ 02:45
I believe you need to define a view to POST to. You likely don't need WTF 
unless you are creating complex/dynamic forms. 

-- 
David Brenneman
(415) 933-9265


On Thursday, February 7, 2013 at 5:30 PM, jamal sasha wrote:

> Sorry for sending so many emails..
> 
> I was going thru the documentation... seems like I need to make forms 
using wtforms??
> http://flask.pocoo.org/docs/patterns/wtforms/
> 
> So, my html code is like this:
> <div class="checksheet">
>    
>     <input id="XML Parser" class="checkbox" type="checkbox"/>XML Parser
>     <input id="Feed Parser" class="checkbox" type="checkbox"/>Feed Parser
>     <input id="Text Parser" class="checkbox" type="checkbox"/>Text Parser
>     <input id="Case Normalization" class="checkbox" 
type="checkbox"/>Case Normalization
>     <input id="Stemmer" class="checkbox" type="checkbox"/>  Stemmer
> 
> </div>
> 
> <div class="submit"><input type="submit"  value="Submit"></div>
> 
> 
> On submit what I want is that I capture all the checkboxes that user has
selected? 
> If I can some input.. I would really appreciate it..
> Thanks..
> 
> 
> 
> 
> On Thu, Feb 7, 2013 at 4:33 PM, jamal sasha <jamalshasha@gmail.com 
(mailto:jamalshasha@gmail.com)> wrote:
> > Hi... 
> > 
> >    So here is what I am trying to do...From the page.. the user will 
essentially fill a form... (few check boxes..) 
> > 
> > Now.. after that user presesses submit.. I have another python script 
waiting to get all this information to be processed accordingly.. 
> > 
> > lets say.. 
> > 
> > def user_pressed():
> >       responses = the_user_has_asked_for()
> > 
> > 
> > Now.. how do i connect this python code with the flask app ?? 
> > Any suggestions?
> > Thanks
> > 
> > 
> > 
> > 
> > 
> > On Thu, Feb 7, 2013 at 12:38 AM, Jesaja Everling <jeverling@gmail.com 
(mailto:jeverling@gmail.com)> wrote:
> > > Hi Jamal,
> > > 
> > > Logging is probably what you are looking for:
> > > http://flask.pocoo.org/docs/errorhandling/#error-mails
> > > Flask already uses a logger to display the messages in the terminal,
> > > you can register additional handlers for this logger. A Filehandler
> > > should let you capture those responses into a file. I think the
> > > messages you see on the Terminal will only be emitted when a handler
> > > is registered with the level DEBUG.
> > > Just look at the example in the docs for the SMTPHandler, and adjust
> > > it to use a [Rotating]FileHandler.
> > > 
> > > Best Regards,
> > > 
> > > Jesaja Everling
> > > 
> > > 
> > > On Thu, Feb 7, 2013 at 8:59 AM, jamal sasha <jamalshasha@gmail.com 
(mailto:jamalshasha@gmail.com)> wrote:
> > > > hi,
> > > >
> > > >    I can see that every interaction I generate on the page is captured on
> > > > the terminal.. is there a way I can "capture" these responses.
> > > > Is it possible if I write a socket program which acts as a client and
> > > > listens to the same host and port, I can maybe capture these responses??
> > > > or is there any simpler way.
> > > >
> > 
> 

Re: [flask] capturing the responses from page

From:
David Brenneman
Date:
2013-02-08 @ 02:45
Check out the flaskr blogging app for examples. 

-- 
David Brenneman
(415) 933-9265


On Thursday, February 7, 2013 at 5:30 PM, jamal sasha wrote:

> Sorry for sending so many emails..
> 
> I was going thru the documentation... seems like I need to make forms 
using wtforms??
> http://flask.pocoo.org/docs/patterns/wtforms/
> 
> So, my html code is like this:
> <div class="checksheet">
>    
>     <input id="XML Parser" class="checkbox" type="checkbox"/>XML Parser
>     <input id="Feed Parser" class="checkbox" type="checkbox"/>Feed Parser
>     <input id="Text Parser" class="checkbox" type="checkbox"/>Text Parser
>     <input id="Case Normalization" class="checkbox" 
type="checkbox"/>Case Normalization
>     <input id="Stemmer" class="checkbox" type="checkbox"/>  Stemmer
> 
> </div>
> 
> <div class="submit"><input type="submit"  value="Submit"></div>
> 
> 
> On submit what I want is that I capture all the checkboxes that user has
selected? 
> If I can some input.. I would really appreciate it..
> Thanks..
> 
> 
> 
> 
> On Thu, Feb 7, 2013 at 4:33 PM, jamal sasha <jamalshasha@gmail.com 
(mailto:jamalshasha@gmail.com)> wrote:
> > Hi... 
> > 
> >    So here is what I am trying to do...From the page.. the user will 
essentially fill a form... (few check boxes..) 
> > 
> > Now.. after that user presesses submit.. I have another python script 
waiting to get all this information to be processed accordingly.. 
> > 
> > lets say.. 
> > 
> > def user_pressed():
> >       responses = the_user_has_asked_for()
> > 
> > 
> > Now.. how do i connect this python code with the flask app ?? 
> > Any suggestions?
> > Thanks
> > 
> > 
> > 
> > 
> > 
> > On Thu, Feb 7, 2013 at 12:38 AM, Jesaja Everling <jeverling@gmail.com 
(mailto:jeverling@gmail.com)> wrote:
> > > Hi Jamal,
> > > 
> > > Logging is probably what you are looking for:
> > > http://flask.pocoo.org/docs/errorhandling/#error-mails
> > > Flask already uses a logger to display the messages in the terminal,
> > > you can register additional handlers for this logger. A Filehandler
> > > should let you capture those responses into a file. I think the
> > > messages you see on the Terminal will only be emitted when a handler
> > > is registered with the level DEBUG.
> > > Just look at the example in the docs for the SMTPHandler, and adjust
> > > it to use a [Rotating]FileHandler.
> > > 
> > > Best Regards,
> > > 
> > > Jesaja Everling
> > > 
> > > 
> > > On Thu, Feb 7, 2013 at 8:59 AM, jamal sasha <jamalshasha@gmail.com 
(mailto:jamalshasha@gmail.com)> wrote:
> > > > hi,
> > > >
> > > >    I can see that every interaction I generate on the page is captured on
> > > > the terminal.. is there a way I can "capture" these responses.
> > > > Is it possible if I write a socket program which acts as a client and
> > > > listens to the same host and port, I can maybe capture these responses??
> > > > or is there any simpler way.
> > > >
> > 
> 

Re: [flask] capturing the responses from page

From:
jamal sasha
Date:
2013-02-08 @ 06:42
Thanks for info :)


On Thu, Feb 7, 2013 at 6:45 PM, David Brenneman <db@davidbrenneman.com>wrote:

>  Check out the flaskr blogging app for examples.
>
> --
> David Brenneman
> (415) 933-9265
>
> On Thursday, February 7, 2013 at 5:30 PM, jamal sasha wrote:
>
> Sorry for sending so many emails..
>
> I was going thru the documentation... seems like I need to make forms
> using wtforms??
> http://flask.pocoo.org/docs/patterns/wtforms/
>
> So, my html code is like this:
> <div class="checksheet">
>
>     <input id="XML Parser" class="checkbox" type="checkbox"/>XML Parser
>     <input id="Feed Parser" class="checkbox" type="checkbox"/>Feed Parser
>     <input id="Text Parser" class="checkbox" type="checkbox"/>Text Parser
>     <input id="Case Normalization" class="checkbox" type="checkbox"/>Case
> Normalization
>     <input id="Stemmer" class="checkbox" type="checkbox"/>  Stemmer
>
> </div>
>
> <div class="submit"><input type="submit"  value="Submit"></div>
>
>
> On submit what I want is that I capture all the checkboxes that user has
> selected?
> If I can some input.. I would really appreciate it..
> Thanks..
>
>
> On Thu, Feb 7, 2013 at 4:33 PM, jamal sasha <jamalshasha@gmail.com> wrote:
>
> Hi...
>
>    So here is what I am trying to do...From the page.. the user will
> essentially fill a form... (few check boxes..)
>
> Now.. after that user presesses submit.. I have another python script
> waiting to get all this information to be processed accordingly..
>
> lets say..
>
> def user_pressed():
>       responses = the_user_has_asked_for()
>
>
> Now.. how do i connect this python code with the flask app ??
> Any suggestions?
> Thanks
>
>
>
>
>
> On Thu, Feb 7, 2013 at 12:38 AM, Jesaja Everling <jeverling@gmail.com>wrote:
>
> Hi Jamal,
>
> Logging is probably what you are looking for:
> http://flask.pocoo.org/docs/errorhandling/#error-mails
> Flask already uses a logger to display the messages in the terminal,
> you can register additional handlers for this logger. A Filehandler
> should let you capture those responses into a file. I think the
> messages you see on the Terminal will only be emitted when a handler
> is registered with the level DEBUG.
> Just look at the example in the docs for the SMTPHandler, and adjust
> it to use a [Rotating]FileHandler.
>
> Best Regards,
>
> Jesaja Everling
>
>
> On Thu, Feb 7, 2013 at 8:59 AM, jamal sasha <jamalshasha@gmail.com> wrote:
> > hi,
> >
> >    I can see that every interaction I generate on the page is captured on
> > the terminal.. is there a way I can "capture" these responses.
> > Is it possible if I write a socket program which acts as a client and
> > listens to the same host and port, I can maybe capture these responses??
> > or is there any simpler way.
> >
>
>
>
>
>

Re: [flask] capturing the responses from page

From:
jamal sasha
Date:
2013-02-08 @ 20:02
Hi,
  I tried to achieve this..here is my simple html code:
<form action="." method="POST">
<div class="checksheet">

    <input id="XML Parser" name="xmlparser" class="checkbox"
type="checkbox">XML Parser
    <input id="Feed Parser" name="feedparser" class="checkbox"
type="checkbox">Feed Parser
    <input id="Text Parser" name="textparser" class="checkbox"
type="checkbox">Text Parser
    <input id="Case Normalization" name="casenormalization"
class="checkbox" type="checkbox">Case Normalization
    <input id="Stemmer" name="stemmer" class="checkbox" type="checkbox">
 Stemmer

</div>

<div class="submit"><input type="submit"  value="Send"
name="raw_text"></div>
</form>

And here is my routes.py code..

@app.route('/raw_text.html')
def home ():
    file = "sample.xml"
    contents = open(file).read()

    contents = contents.decode('utf-8')
    return render_template('raw_text.html',  contents=contents,file=file)

@app.route('/raw_text.html',methods=['POST'])
def get_data():
    print "REQUEST ",request.form()
    data = request.form['raw_text']
    print data
    return "Processed"

Not Found

The requested URL was not found on the server.

If you entered the URL manually please check your spelling and try again.


On Thu, Feb 7, 2013 at 10:42 PM, jamal sasha <jamalshasha@gmail.com> wrote:

> Thanks for info :)
>
>
> On Thu, Feb 7, 2013 at 6:45 PM, David Brenneman <db@davidbrenneman.com>wrote:
>
>>  Check out the flaskr blogging app for examples.
>>
>> --
>> David Brenneman
>> (415) 933-9265
>>
>> On Thursday, February 7, 2013 at 5:30 PM, jamal sasha wrote:
>>
>> Sorry for sending so many emails..
>>
>> I was going thru the documentation... seems like I need to make forms
>> using wtforms??
>> http://flask.pocoo.org/docs/patterns/wtforms/
>>
>> So, my html code is like this:
>> <div class="checksheet">
>>
>>     <input id="XML Parser" class="checkbox" type="checkbox"/>XML Parser
>>     <input id="Feed Parser" class="checkbox" type="checkbox"/>Feed Parser
>>     <input id="Text Parser" class="checkbox" type="checkbox"/>Text Parser
>>     <input id="Case Normalization" class="checkbox" type="checkbox"/>Case
>> Normalization
>>     <input id="Stemmer" class="checkbox" type="checkbox"/>  Stemmer
>>
>> </div>
>>
>> <div class="submit"><input type="submit"  value="Submit"></div>
>>
>>
>> On submit what I want is that I capture all the checkboxes that user has
>> selected?
>> If I can some input.. I would really appreciate it..
>> Thanks..
>>
>>
>> On Thu, Feb 7, 2013 at 4:33 PM, jamal sasha <jamalshasha@gmail.com>wrote:
>>
>> Hi...
>>
>>    So here is what I am trying to do...From the page.. the user will
>> essentially fill a form... (few check boxes..)
>>
>> Now.. after that user presesses submit.. I have another python script
>> waiting to get all this information to be processed accordingly..
>>
>> lets say..
>>
>> def user_pressed():
>>       responses = the_user_has_asked_for()
>>
>>
>> Now.. how do i connect this python code with the flask app ??
>> Any suggestions?
>> Thanks
>>
>>
>>
>>
>>
>> On Thu, Feb 7, 2013 at 12:38 AM, Jesaja Everling <jeverling@gmail.com>wrote:
>>
>> Hi Jamal,
>>
>> Logging is probably what you are looking for:
>> http://flask.pocoo.org/docs/errorhandling/#error-mails
>> Flask already uses a logger to display the messages in the terminal,
>> you can register additional handlers for this logger. A Filehandler
>> should let you capture those responses into a file. I think the
>> messages you see on the Terminal will only be emitted when a handler
>> is registered with the level DEBUG.
>> Just look at the example in the docs for the SMTPHandler, and adjust
>> it to use a [Rotating]FileHandler.
>>
>> Best Regards,
>>
>> Jesaja Everling
>>
>>
>> On Thu, Feb 7, 2013 at 8:59 AM, jamal sasha <jamalshasha@gmail.com>
>> wrote:
>> > hi,
>> >
>> >    I can see that every interaction I generate on the page is captured
>> on
>> > the terminal.. is there a way I can "capture" these responses.
>> > Is it possible if I write a socket program which acts as a client and
>> > listens to the same host and port, I can maybe capture these responses??
>> > or is there any simpler way.
>> >
>>
>>
>>
>>
>>
>

Re: [flask] capturing the responses from page

From:
jamal sasha
Date:
2013-02-08 @ 20:30
My dear friends. I figured it out :)
Never mind...


On Fri, Feb 8, 2013 at 12:02 PM, jamal sasha <jamalshasha@gmail.com> wrote:

> Hi,
>   I tried to achieve this..here is my simple html code:
> <form action="." method="POST">
> <div class="checksheet">
>
>     <input id="XML Parser" name="xmlparser" class="checkbox"
> type="checkbox">XML Parser
>     <input id="Feed Parser" name="feedparser" class="checkbox"
> type="checkbox">Feed Parser
>     <input id="Text Parser" name="textparser" class="checkbox"
> type="checkbox">Text Parser
>     <input id="Case Normalization" name="casenormalization"
> class="checkbox" type="checkbox">Case Normalization
>     <input id="Stemmer" name="stemmer" class="checkbox" type="checkbox">
>  Stemmer
>
> </div>
>
> <div class="submit"><input type="submit"  value="Send"
> name="raw_text"></div>
> </form>
>
> And here is my routes.py code..
>
> @app.route('/raw_text.html')
> def home ():
>     file = "sample.xml"
>     contents = open(file).read()
>
>     contents = contents.decode('utf-8')
>     return render_template('raw_text.html',  contents=contents,file=file)
>
> @app.route('/raw_text.html',methods=['POST'])
> def get_data():
>     print "REQUEST ",request.form()
>     data = request.form['raw_text']
>     print data
>     return "Processed"
>
> Not Found
>
> The requested URL was not found on the server.
>
> If you entered the URL manually please check your spelling and try again.
>
>
> On Thu, Feb 7, 2013 at 10:42 PM, jamal sasha <jamalshasha@gmail.com>wrote:
>
>> Thanks for info :)
>>
>>
>> On Thu, Feb 7, 2013 at 6:45 PM, David Brenneman <db@davidbrenneman.com>wrote:
>>
>>>  Check out the flaskr blogging app for examples.
>>>
>>> --
>>> David Brenneman
>>> (415) 933-9265
>>>
>>> On Thursday, February 7, 2013 at 5:30 PM, jamal sasha wrote:
>>>
>>> Sorry for sending so many emails..
>>>
>>> I was going thru the documentation... seems like I need to make forms
>>> using wtforms??
>>> http://flask.pocoo.org/docs/patterns/wtforms/
>>>
>>> So, my html code is like this:
>>> <div class="checksheet">
>>>
>>>     <input id="XML Parser" class="checkbox" type="checkbox"/>XML Parser
>>>     <input id="Feed Parser" class="checkbox" type="checkbox"/>Feed Parser
>>>     <input id="Text Parser" class="checkbox" type="checkbox"/>Text Parser
>>>     <input id="Case Normalization" class="checkbox"
>>> type="checkbox"/>Case Normalization
>>>     <input id="Stemmer" class="checkbox" type="checkbox"/>  Stemmer
>>>
>>> </div>
>>>
>>> <div class="submit"><input type="submit"  value="Submit"></div>
>>>
>>>
>>> On submit what I want is that I capture all the checkboxes that user has
>>> selected?
>>> If I can some input.. I would really appreciate it..
>>> Thanks..
>>>
>>>
>>> On Thu, Feb 7, 2013 at 4:33 PM, jamal sasha <jamalshasha@gmail.com>wrote:
>>>
>>> Hi...
>>>
>>>    So here is what I am trying to do...From the page.. the user will
>>> essentially fill a form... (few check boxes..)
>>>
>>> Now.. after that user presesses submit.. I have another python script
>>> waiting to get all this information to be processed accordingly..
>>>
>>> lets say..
>>>
>>> def user_pressed():
>>>       responses = the_user_has_asked_for()
>>>
>>>
>>> Now.. how do i connect this python code with the flask app ??
>>> Any suggestions?
>>> Thanks
>>>
>>>
>>>
>>>
>>>
>>> On Thu, Feb 7, 2013 at 12:38 AM, Jesaja Everling <jeverling@gmail.com>wrote:
>>>
>>> Hi Jamal,
>>>
>>> Logging is probably what you are looking for:
>>> http://flask.pocoo.org/docs/errorhandling/#error-mails
>>> Flask already uses a logger to display the messages in the terminal,
>>> you can register additional handlers for this logger. A Filehandler
>>> should let you capture those responses into a file. I think the
>>> messages you see on the Terminal will only be emitted when a handler
>>> is registered with the level DEBUG.
>>> Just look at the example in the docs for the SMTPHandler, and adjust
>>> it to use a [Rotating]FileHandler.
>>>
>>> Best Regards,
>>>
>>> Jesaja Everling
>>>
>>>
>>> On Thu, Feb 7, 2013 at 8:59 AM, jamal sasha <jamalshasha@gmail.com>
>>> wrote:
>>> > hi,
>>> >
>>> >    I can see that every interaction I generate on the page is captured
>>> on
>>> > the terminal.. is there a way I can "capture" these responses.
>>> > Is it possible if I write a socket program which acts as a client and
>>> > listens to the same host and port, I can maybe capture these
>>> responses??
>>> > or is there any simpler way.
>>> >
>>>
>>>
>>>
>>>
>>>
>>
>