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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:57:56+00:00 2026-06-01T03:57:56+00:00

I am using tweepy (a python lib for twitter api) to create a twitter

  • 0

I am using tweepy (a python lib for twitter api) to create a twitter app. Below is the django view code where I am creating an OAuthHandler with consumer key,secret and getting request token and saving it in django.messages and redirecting it to the authorization url.

Later during the callback view I am retrieving the request token and creating an OAUthHandler, but I getting this below error on ‘auth.get_access_token(v)’

TweepError at /twitter/return/

argument 2 to map() must support iteration

Traceback :
File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py" in get_response
111.                         response = callback(request, *callback_args, **callback_kwargs)

File "/home/nzee/Downloads/uday/homepage/../homepage/users/views.py" in tw_return
80.   auth.get_access_token(v)


File "/usr/local/lib/python2.6/dist-packages/tweepy-1.9-py2.6.egg/tweepy/auth.py" in get_access_token
126.             raise TweepError(e)

Exception Type: TweepError at /twitter/return/ Exception Value:
argument 2 to map() must support iteration

Views.py code below

def tw_return(request):
  v = request.GET.get('oauth_verifier')

  key = settings.TWITTER_KEY
  secret = settings.TWITTER_SECRET
  auth = tweepy.OAuthHandler(key, secret)

  mess = get_messages(request)

  a=[]
  for m in mess:
    a.append(m)

  auth.set_request_token(a[0],a[1])

  auth.get_access_token(v)

  api = tweepy.API(auth)
  api.update_status('tweepy + oauth1!')
  return HttpResponseRedirect('/')      

def twitter(request):
  key = settings.TWITTER_KEY
  secret = settings.TWITTER_SECRET
  auth = tweepy.OAuthHandler(key, secret)
  try:
    redirect_url = auth.get_authorization_url()
  except tweepy.TweepError:
    raise Http404

  messages.add_message(request, messages.INFO, auth.request_token.key)
  messages.add_message(request, messages.INFO, auth.request_token.secret)
  return HttpResponseRedirect(redirect_url)
  • 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-01T03:57:57+00:00Added an answer on June 1, 2026 at 3:57 am

    wrong: I suspect that you are not receiving an oauth_verifier, so it’s value is None (i.e., not an iterable)

    this question may help: Tweepy twitter oauth authentication not returning oauth_verifier

    Here’s an example of an appEngine handler that uses tweepy, maybe it’ll help?

    https://github.com/sclm/tweepy-examples/blob/master/appengine/oauth_example/handlers.py

    Final Answer:

    I think you are not getting the correct request token from get_messages()… the error you are getting occurs if you call auth.set_request_token() with None. Found this in the issues on github for tweepy https://github.com/tweepy/tweepy/issues/25

    # WRONG CODE
    auth.set_request_token(None, None)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just began working on a little twitter-app using tweepy. is there any kind
I was writing a twitter program using tweepy. When I run this code, it
I am using a python library called tweepy for twitter. When I try to
I'm writing a twitter bot using tweepy that will search for mentions to it
I am using the tweepy-gae library to do authenticated (oauth) calls to the twitter
I am using Tweepy, but I am trying to use it with the api
using Tweepy in my app, I get this Exception very often, just after sending
Using Rails 3.2.0.rc2 and ruby 1.9.3p0 In app/views/requests/_form.html.erb I have the following code for
I am using this code to get the userInfo twitter = oauthtwitter.OAuthApi(CONSUMER_KEY, CONSUMER_SECRET, access_token)
Using PyObjC , you can use Python to write Cocoa applications for OS X.

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.