>From what you're written, I think you've become confused by different 
Python projects that have similar names and APIs.

In Pyramid, we have a "request" object in each view. 

Pyramid's "request" is a subclass of WebOb 
(http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/webob.html). 
 It represents the active request.

Pyramid's "request" can be configured to have a "session" attribute that is 
used to maintain state between requests for a single user 
("request.session").   On each Pyramid "request" (web page view), Pyramid 
can automatically create a `request.session` for you (if sessions are 
enabled).

This is entirely unrelated to the Python library called `requests`, which 
is what you would need  to communicate with the REST server and would be 
configured with your API credentials..

If you want to use the `requests` library to talk to the REST API, you have 
to create a new instance of the "Session" object from the `requests` 
library in your view.  The "Session" object from the `requests` library can 
`.get()` or `.post()` to the REST API.  

That `requests` object would need to be configured with the account data 
(which you can store in Pyramid's `request.session`). 

Pyramid will not generate or persist the Session object from `requests` 
across connections for you; it is not related to `request.session` or 
Pyramid at all. 

On every Pyramid view, you will need to create a new `requests` library 
Session object and use it to talk to the 3rd party API.  If you want to 
persist any data, you can store that in Pyramid's `request.session` storage.

You can not use a "global" instance of `requests.Session`, because of 
issues with multiple users or a single user hitting a different pyramid 
worker.

-- 
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.
Visit this group at https://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.

Reply via email to