A few thoughts, no answers or suggestions (other than the first )

- if you need to do internal requests, use `requests`.  `urllib` is the 
devil.

- if this is just a handful of views, I would probably have Pyramid1 set an 
auth-token, either as a cookie a get argument, and redirect to Pyramid2. 
 Pyramid2 can then validate and expire the token. I do something similar 
with a centralized login system, where I have to transfer sessions across 
domains.  Since I control both servers, and can coordinate server-secrets 
for hashing or encryption keys, I don't have to deal with the overhead or 
UX of OAuth.

- is there any reason why you can't use a shared authentication routine 
between both apps , and just have a direct request ?

- have you thought about using something like celery ?

- we designed our stack to be "fronted" with pyramid, but be SOA behind the 
scenes.  all the http stuff is in a single pyramid app now, but certain 
routines are ready to be split out as needed.  depending on what you need 
to do, here's some what we learned:

   `requests` was the best library to use; mostly because of the 
consolidated exception handling.  if you use urllib, there's at least 5 -- 
possibly more -- exceptions that will routinely bubble up.  querying a 
local pyramid app was ridiculously fast and efficient in the 
proof-of-concept phase.  

   for most situations, we found JSON to be the best communication format. 
 our backend servers always returns a JSON doc (even on errors).

   returning a "document" was a pain.

   - if you generate rendered HTML and try to proxy things, you end need to 
use the HTTP status code of the backend app.  occasionally you will end up 
generating 200OK on errors; you also have to keep all the error messaging 
and templating in sync between both apps.   i preferred wrapping any HTML 
in a json doc; but really preferred all templating to happen on the 
frontend app.

   - if you generate a large document... we tabled it.  it'll need to be 
revisited in the future.  the problem was with memory and computer 
performance.  you need to use "stream=True" on requests to iterate the 
backend response into a tempfile, then have pyramid deliver that... but we 
couldn't find a sweet spot on the tempfile/chunking settings or on getting 
it out of pyramid. 

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.

Reply via email to