Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9004093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:49:28+00:00 2026-06-16T00:49:28+00:00

I created a twitter.Twitter object, but cannot store it into session. Following is my

  • 0

I created a twitter.Twitter object, but cannot store it into session. Following is my code.

t = twitter.Twitter(auth=twitter.OAuth(consumer_key, consumer_secret, 
    oauth_token, oauth_secret))    
request.session['t'] = t

but if I store a string like

request.session['t'] = 't'

it works, why? because the twitter#Twitter object is not a serializable object? How can I avoid authenticating each time when I need a twitter#Twitter object? Following is the django trace.

Django Version: 1.3.1
Python Version: 2.6.6
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'myproj.myapp']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware')


Traceback:
File "/usr/lib/python2.6/site-packages/django/core/handlers/base.py" in get_response
  178.                 response = middleware_method(request, response)
File "/usr/lib/python2.6/site-packages/django/contrib/sessions/middleware.py" in process_response
  36.                 request.session.save()
File "/usr/lib/python2.6/site-packages/django/contrib/sessions/backends/file.py" in save
  121.                     os.write(output_file_fd, self.encode(session_data))
File "/usr/lib/python2.6/site-packages/django/contrib/sessions/backends/base.py" in encode
  93.         pickled = pickle.dumps(session_dict, pickle.HIGHEST_PROTOCOL)
File "/usr/lib/python2.6/site-packages/twitter-1.9.0-py2.6.egg/twitter/api.py" in __call__
  173.         return self._handle_response(req, uri, arg_data)
File "/usr/lib/python2.6/site-packages/twitter-1.9.0-py2.6.egg/twitter/api.py" in _handle_response
  198.                 raise TwitterHTTPError(e, uri, self.format, arg_data)

Exception Type: TwitterHTTPError at /tool/log_in/
Exception Value: 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T00:49:29+00:00Added an answer on June 16, 2026 at 12:49 am

    Exactly as you guessed, you can only store pickleable objects.

    From the docs

    The session dictionary should accept any pickleable Python object. See the pickle module for more information.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created a PHP function that will automatically turn URLs into links, link Twitter
I am trying to convert the twitter post dates into datetime objects but for
I'm trying to parse a Twitter atom feed in PHP but am running into
I have created the following javascript object dynamically (from PHP): var t_feed = '';
I'm trying to implement a Twitter authentication via OAuth on my Django application, but
I'm catching data-async of form created using twitter bootstrap in following manner: $('form[data-async]').live('submit', function(event)
I have created Twitter bots for many geographic locations. I want to allow users
I'm trying to set up Omniauth login for Twitter/FB. I created my own authentication
If I create social portal similar to Twitter (not exactly twitter, but similar in
I am working with a java Twitter app (using Twitter4J api). I have created

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.