Note that there are some explanatory texts on larger screens.

plurals
  1. PORauth __attrs__ with OAuth2Service.get_session
    primarykey
    data
    text
    <p>Having problems with Rauth (or Reqeuests) Oauth2 session usage. Hope the code and error below makes sense. </p> <p>Thanks, Steve</p> <p>Error Message: <code>'OAuth2Session' object has no attribute '__attrs__'</code></p> <p>Code:</p> <pre><code>self.auth_service = OAuth2Service( name=self.PARSER_NAME, client_id=self.CLIENT_ID, client_secret=self.CLIENT_SECRET, access_token_url=self.ACCESS_TOKEN_URL, authorize_url=self.AUTHORIZE_URL, base_url=self.BASE_URL, ) session = self.auth_service.get_session(token=token_data["access_token"]) # I tried this as an alternate way to get the session with same results #session = OAuth2Session(self.CLIENT_ID, self.CLIENT_SECRET, access_token=token_data["access_token"]) self.request.session['oauth_session'] = session </code></pre> <p>Error:</p> <pre><code> Request Method: GET Request URL: http://example.com/parsers/login/moves/?code=Apdo3m7m3nEA64rUW0cof85Sq6Lp_Aua4HB_Hd0QJXvWqpf1JeXSNDIt1wEdBYSy&amp;state= Django Version: 1.4.3 Exception Type: AttributeError Exception Value: 'OAuth2Session' object has no attribute '__attrs__' Exception Location: /Library/Python/2.7/site-packages/requests/sessions.py in __getstate__, line 397 Python Executable: /usr/bin/python Python Version: 2.7.2 Python Path: ['/Library/Python/2.7/site-packages/pip-1.2.1-py2.7.egg', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC', '/Library/Python/2.7/site-packages', '/Projects/motiv8/'] Server time: Tue, 11 Jun 2013 11:32:16 -0700 </code></pre> <p>Looks like it traces back to the requests sessions:</p> <pre><code>/Library/Python/2.7/site-packages/requests/sessions.py in __getstate__ return dict((attr, getattr(self, attr, None)) for attr in self.__attrs__) </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload