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

examples.print_user_archive() #18

Open
JoseCR99 opened this issue Jan 1, 2019 · 3 comments
Open

examples.print_user_archive() #18

JoseCR99 opened this issue Jan 1, 2019 · 3 comments

Comments

@JoseCR99
Copy link

JoseCR99 commented Jan 1, 2019

I have the following error:

In [5]: examples.print_user_archive()

TypeError Traceback (most recent call last)
in ()
----> 1 examples.print_user_archive()

/home/ubuntu/twitterresearch/examples.pyc in print_user_archive()
111 """
112 archive_generator = rest.fetch_user_archive("lessig")
--> 113 for page in archive_generator:
114 for tweet in page:
115 print_tweet(tweet)

/home/ubuntu/twitterresearch/rest.pyc in fetch_user_archive(user, **kwargs)
261 # If we have a valid max_id, use that; else do a simple normal request
262 result, tweets = fetch_user_tweets(
--> 263 user, max_id=max_id, **kwargs) if max_id else fetch_user_tweets(user)
264 # Set the status variable - if it's not 200, that's an error and the loop exits
265 status = result.status_code

/home/ubuntu/twitterresearch/rest.pyc in fetch_user_tweets(user, **kwargs)
237 elif isinstance(user, str):
238 kwargs['screen_name'] = user
--> 239 result = throttled_call(USER_TIMELINE_URL, params=kwargs)
240 # Decode JSON
241 return (result, json.loads(result.text))

/home/ubuntu/twitterresearch/rest.pyc in wrapper(*args, **kwargs)
141 patched_data = lengthen_text(response_json)
142 # Monkey patching since .text and .content are read-only
--> 143 response._content = bytes(json.dumps(patched_data), encoding='utf-8')
144 return response
145 return wrapper

TypeError: str() takes at most 1 argument (2 given)

@trifle
Copy link
Owner

trifle commented Jan 7, 2019

Hi, the example works for me.
That error basically says that at some point, we try to print/display one thing but get two.
I suspect you might be getting an error which can't be displayed.
Could you try the raw call:

result, tweets = fetch_user_tweets("lessig")

And post the contents of result and tweets?

@Millesimus
Copy link
Contributor

I recently had the same issue but it disappeared after downloading a fresh clone. Do you have an up-to-date version of the package on your system, @JoseCR99 ?

@trifle
Copy link
Owner

trifle commented Jan 11, 2019

Thanks for the hint, @Millesimus. Always worth trying out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants