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 4064488
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T15:51:42+00:00 2026-05-20T15:51:42+00:00

I receive a CannotSendRequest in my oauth library (Django socialauth) when I try to

  • 0

I receive a CannotSendRequest in my oauth library (Django socialauth) when I try to connect to Twitter.

Traceback:
File "/Library/Python/2.6/site-packages/django/core/handlers/base.py" in get_response
100.                     response = callback(request, *callback_args, **callback_kwargs)
File "/Users/me/webfaction/project/socialauth/views.py" in twitter_login
94.     request_token = twitter.fetch_request_token(callback=request.build_absolute_uri(reverse('socialauth_twitter_login_done')))
File "/Users/me/webfaction/project/socialauth/lib/oauthtwitter2.py" in fetch_request_token
50.         return oauth.OAuthToken.from_string(oauth_response(oauth_request))
File "/Users/me/webfaction/project/socialauth/lib/oauthtwitter2.py" in oauth_response
33.     connection().request(req.http_method, req.to_url())
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/httplib.py" in   request
914.             self._send_request(method, url, body, headers)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/httplib.py" in _send_request
931.         self.putrequest(method, url, **skips)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/httplib.py" in putrequest
818.             raise CannotSendRequest()

Exception Type: CannotSendRequest at /accounts/twitter_login/
Exception Value: 

Here’s where I’m creating the HTTP connection

def connection():
    try: 
        return connection._connection
    except AttributeError:
        connection._connection = httplib.HTTPSConnection(TWITTER_URL)
    return connection._connection

def oauth_response(req):
    connection().request(req.http_method, req.to_url())
    return connection().getresponse().read()

I’ve searched SO and found these links, but I’m still not sure how to implement the solution. I’ve tried and failed. Any help would be appreciated.

httplib CannotSendRequest error in WSGI

When I use httplib for my OAUTH in Python, I always get "CannotSendRequest" and then "

  • 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-05-20T15:51:43+00:00Added an answer on May 20, 2026 at 3:51 pm

    The post you linked to says this error happens when you reuse connections that have thrown an exception and didn’t make it to the getresponse() stage.

    Indeed, connection.request("GET", "/") x 2 throws the error.

    The solution suggested is to re-create the connection every time. Is that what you want to do? Note I have no opinions on this matter, you just asked how to implement what’s on those posts.

    If so, get rid of your connection() function and always do

    connection = httplib.HTTPSConnection(TWITTER_URL)
    connection.request(req.http_method, req.to_url())
    response = connection.getresponse().read()
    connection.close()
    return response
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I receive Date and time from CSV file The received Date format is YYYYMMDD
I receive a daily XML file that contains thousands of records, each being a
We receive vendor confirmation of file feeds that we send out. Some of our
I receive this error when I try to run the maven goal - mvn
I receive this message (see image below) when I try to edit in debugging.
I receive Could not load file or assembly 'DeployLX.Licensing.v3, Version=3.1.2000.0, Culture=neutral, PublicKeyToken=798276055709c98a' or one
I receive error FATAL: could not create lock file postmaster.pid: Permission denied when trying
I receive the following error when I use weblcient to upload a file System.Net.WebException:
I receive a date-time from automation system like this: 00:00:30:00 . When I try
I receive a file that contains the following: \direcotry1\directory2\directory3\file1 \direcotry1\file2 \direcotry1\directory2\directory3\directory4\file3 \direcotry1\file4 \direcotry1\directory2\file5 file6

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.