It depends on what you're communicating with, and why.

If your synchronous tasks are done "quickly" or must be "blocking" -- like 
doing some oAuth or hitting an external API that is guaranteed to return a 
request within a second or two, I would just use `requests` from within 
Pyramid.

If you're concerned with extended processing on your end, or not using 
systems that guarantee a response within a given amount of time... I would 
use Pyramid to trigger a Celery task, and then have the page reload every 5 
seconds to poll the Celery backend for status.

The reason for the latter usage pattern is that you will end up with a mix 
of browser timeouts / dropped connections AND tying up Pyramid workers 
while you wait on the upstream data.  Blocking while waiting on `requests` 
to process the response will end up creating a bottleneck.

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pylons-discuss+unsubscr...@googlegroups.com.
To post to this group, send email to pylons-discuss@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/0291364d-0822-4e1b-9d0e-26a232d16d42%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to