request.vars, request.post_vars, and request.get_vars are properties (and 
their values are filled in lazily upon first access), so they are ignored 
by BEAUTIFY (which only includes attributes found in request.keys()). If 
you want the entire request object, you could try the trick used in 
response.toolbar:

    request.post_vars = request.post_vars
    archivo.write(BEAUTIFY(request).xml())

That will retrieve the post_vars and change request.post_vars to an 
attribute, which BEAUTIFY will then display.

Anthony

On Monday, March 7, 2016 at 10:07:00 AM UTC-5, Lisandro wrote:
>
> I'm using SparkPost [1] (a transactional email platform) through its API 
> [2].
>
> I'm trying to implement their webhook.
> I have already set up a public URL in my app to let SparkPost send a POST 
> each time a message is opened (that is, one of the messages I previously 
> sent throug the API).
>
> The problem is that *I'm receiving the POST request, but nothing in 
> post_vars, no vars, nothing*.
> However, the headers do include some stuff that needs to be there, 
> accordingly to SparkPost documentation [3].
>
>
> My public function is really simple, just writes a BEAUTIFY(request) to a 
> log file:
>
> def sparkpost_message_opened():
>     archivo = open('webhook.log', 'a')
>     archivo.write('------------------------------------\n')
>     archivo.write(BEAUTIFY(request).xml())
>     archivo.write('\n')
>     archivo.close()
>     return HTTP(200)
>
> However, when I check the received data, I see that the request object 
> doesn't have post_vars or vars.
> I think the problem could be in the SparkPost side, but I'm not sure.
> How can I double check? Is there a way that I can see the post data that 
> was sent? I'm using nginx.
>
>
> [1] https://sparkpost.com
> [2] https://developers.sparkpost.com/api/
> [3] 
> https://support.sparkpost.com/customer/en/portal/articles/2311698-comparing-webhook-and-message-event-data
>
>
> Thanks in advance!
> Regards, Lisandro. 
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to