Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IdIterator fix TypeError: _call() got multiple values for keyword argumet 'max_id' #446

Merged
merged 1 commit into from Jun 10, 2014

Conversation

@andreip
Copy link
Contributor

@andreip andreip commented Jun 9, 2014

Reproduce problem

cursor = tweepy.Cursor(api.user_timeline, screen_name='google', max_id=24130020972)
for tweet in cursor.items():
     pass

this will fail, see below

  File "main.py", line 84, in get_tweets
    for tweet in cursor.items():
  File "/Users/andrei/.virtualenvs/ml/lib/python2.7/site-packages/tweepy/cursor.py", line 181, in next
    self.current_page = self.page_iterator.next()
  File "/Users/andrei/.virtualenvs/ml/lib/python2.7/site-packages/tweepy/cursor.py", line 99, in next
    data = self.method(max_id=self.max_id, parser=RawParser(), *self.args, **self.kargs)
TypeError: _call() got multiple values for keyword argument 'max_id'

>>> import tweepy
>>> tweepy.__version__
'2.3.0'
>>> 
(ml)~/repos/github/licenta (master)*$ pip freeze|grep tweepy
tweepy==2.3.0

Underlaying problem

def f(**kargs):
    pass 
f(max_id=2, **{'max_id':2})

# fails with
TypeError: f() got multiple values for keyword argument 'max_id'

So doing a pop is necessary there. Also, max_id=None works as expected for twitter API, returns everything as far as I could tell.

…ument 'max_id'.

The problem is that max_id is passed in self.method as param but also
kept in kargs. Doing a kargs.pop with None as default value for 'max_id'
solves the problem as not keeping 'max_id' in two places anymore.
@Aaron1011
Copy link
Member

@Aaron1011 Aaron1011 commented Jun 10, 2014

@andreip: Thanks for finding this!

Aaron1011 added a commit that referenced this issue Jun 10, 2014
IdIterator fix TypeError: _call() got multiple values for keyword argumet 'max_id'
@Aaron1011 Aaron1011 merged commit ffed422 into tweepy:master Jun 10, 2014
1 check failed
@Harmon758 Harmon758 added the Bug label May 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants