Issue 144 in python-twitter: AttributeError: 'unicode' object has no attribute 'get'

1,463 views
Skip to first unread message

python-...@googlecode.com

unread,
Jun 30, 2010, 4:33:39 AM6/30/10
to python-twi...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 144 by hemanth...@gmail.com: AttributeError: 'unicode' object has
no attribute 'get'
http://code.google.com/p/python-twitter/issues/detail?id=144

>>> api = twitter.Api(username='user', password='password')
>>> users = api.GetFriends()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "twitter.py", line 1794, in GetFriends
return [User.NewFromJsonDict(x) for x in data]
File "twitter.py", line 963, in NewFromJsonDict
return User(id=data.get('id', None),
AttributeError: 'unicode' object has no attribute 'get'

Password has special characters in it.

uname -a
Linux ubuntu 2.6.32-21-generic-pae #32-Ubuntu SMP Fri Apr 16 09:39:35 UTC
2010 i686 GNU/Linux

Version Details :
Python 2.6.5
python-twitter-0.6


python-...@googlecode.com

unread,
Jul 8, 2010, 6:04:25 AM7/8/10
to python-twi...@googlegroups.com

Comment #1 on issue 144 by chrisarthur77: AttributeError: 'unicode' object

Get similar error. Password has no special characters - so i get a str eror
rather than a unicode

Traceback (most recent call last):

File "twitterCA.py", line 18, in <module>
users = api.GetFriends()
File "/home/chris/Desktop/twitter.py", line 1820, in GetFriends


return [User.NewFromJsonDict(x) for x in data]

File "/home/chris/Desktop/twitter.py", line 963, in NewFromJsonDict


return User(id=data.get('id', None),

AttributeError: 'str' object has no attribute 'get'

python-...@googlecode.com

unread,
Aug 3, 2010, 12:00:46 PM8/3/10
to python-twi...@googlegroups.com

Comment #2 on issue 144 by bradford.mcgonigle: AttributeError: 'unicode'

I'm getting the same issue with no special characters in the password.

>>> api = twitter.Api(username='username',password='password')
>>> users = api.GetFriends()


Traceback (most recent call last):

File "<console>", line 1, in <module>

File "/home2/spyderfcs/webapps/dev/baselinecreations/ve/src/python-twitter/twitter.py",
line 1794, in GetFriends


return [User.NewFromJsonDict(x) for x in data]

File "/home2/spyderfcs/webapps/dev/baselinecreations/ve/src/python-twitter/twitter.py",

line 963, in NewFromJsonDict
return User(id=data.get('id', None),

python-...@googlecode.com

unread,
Aug 24, 2010, 5:50:21 PM8/24/10
to python-twi...@googlegroups.com

Comment #3 on issue 144 by bear42: AttributeError: 'unicode' object has no
attribute 'get'
http://code.google.com/p/python-twitter/issues/detail?id=144

The root cause for this turns out to be a Twitter change. The JSON data
returned for GetFriends used to only be a list, but now it appears other
data elements are returned.

I've tweaked how the NewFromJsonDict() method for User works so that it now
requests the 'users' item from the base JSON returned and then iterating
over that.

python-...@googlecode.com

unread,
Aug 24, 2010, 5:58:37 PM8/24/10
to python-twi...@googlegroups.com
Updates:
Status: Fixed

Comment #4 on issue 144 by bear42: AttributeError: 'unicode' object has no
attribute 'get'
http://code.google.com/p/python-twitter/issues/detail?id=144

change committed in revision 661a3f9475

python-...@googlecode.com

unread,
Oct 15, 2012, 4:25:04 AM10/15/12
to python-twi...@googlegroups.com

Comment #5 on issue 144 by Scubb...@gmail.com: AttributeError: 'unicode'
I'm getting a simliar error on GetPublicTimeline:

>>> import twitter
>>> ta = twitter.Api(details)
>>> ta.GetPublicTimeline()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "build/bdist.linux-armv6l/egg/twitter.py", line 2301, in
GetPublicTimeline
File "build/bdist.linux-armv6l/egg/twitter.py", line 620, in
NewFromJsonDict

python-...@googlecode.com

unread,
Nov 5, 2012, 1:00:47 AM11/5/12
to python-twi...@googlegroups.com

Comment #6 on issue 144 by qmor.q...@gmail.com: AttributeError: 'unicode'
got the same:
statuses = api.GetPublicTimeline()

File "/usr/local/lib/python2.6/dist-packages/python_twitter-0.8.2-py2.6.egg/twitter.py",
line 2301, in GetPublicTimeline
return [Status.NewFromJsonDict(x) for x in data]

File "/usr/local/lib/python2.6/dist-packages/python_twitter-0.8.2-py2.6.egg/twitter.py",
line 620, in NewFromJsonDict
return Status(created_at=data.get('created_at', None),

python-...@googlecode.com

unread,
Dec 27, 2012, 10:36:46 AM12/27/12
to python-twi...@googlegroups.com

Comment #7 on issue 144 by tom.mele...@gmail.com: AttributeError: 'unicode'
Yeah, I got the same with the latest download. I'm on Ubuntu 12.04. See
below.

I believe the issue is that this endpoint has been renamed to sample.json
AND is part of the streaming API. If I change the endpoint in the code and
pass in base_url to my constructor it moves along, but it is not configured
(or cannot handle, I don't yet know) to handle streaming.

I would just use a different example and the author should probably just
deprecate this call or add additional info on how to use it.

statuses = api.GetPublicTimeline()

File "/usr/local/lib/python2.7/dist-packages/python_twitter-0.8.2-py2.7.egg/twitter.py",
line 2301, in GetPublicTimeline
return [Status.NewFromJsonDict(x) for x in data]

File "/usr/local/lib/python2.7/dist-packages/python_twitter-0.8.2-py2.7.egg/twitter.py",

python-...@googlecode.com

unread,
Jan 9, 2013, 12:03:50 AM1/9/13
to python-twi...@googlegroups.com

Comment #8 on issue 144 by bear42: AttributeError: 'unicode' object has no
attribute 'get'
http://code.google.com/p/python-twitter/issues/detail?id=144

GetPublicTimeline() is deprecated in version 1.1 of the Twitter API

your getting this error because that is how Twitter chose to respond to a
now-deprecated call.

There is no longer any way, except using search, to get what used to be the
Public Timeline

bear

unread,
Jan 14, 2013, 1:04:04 PM1/14/13
to python-...@googlegroups.com
no, the user's id or name - then twitter will return everything that matches... but only a sample of that stream.


On Wed, Jan 9, 2013 at 12:10 AM, Sam Raker <sam....@gmail.com> wrote:
"Except using search"...by searching for what? A space?
--
You received this message because you are subscribed to the Google Groups "python-twitter" group.
To view this discussion on the web visit https://groups.google.com/d/msg/python-twitter/-/HmcpOcqyr34J.

To post to this group, send email to python-...@googlegroups.com.
To unsubscribe from this group, send email to python-twitte...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/python-twitter?hl=en.



--
Bear

be...@xmpp.org (email)
bea...@gmail.com (xmpp, email)
be...@code-bear.com (xmpp, email)
http://code-bear.com/bearlog (weblog)

PGP Fingerprint = 9996 719F 973D B11B E111  D770 9331 E822 40B3 CD29

python-...@googlecode.com

unread,
Feb 3, 2013, 4:08:06 PM2/3/13
to python-twi...@googlegroups.com

Comment #9 on issue 144 by mccall...@gmail.com: AttributeError: 'unicode'
I am getting this when I run api.GetMentions()

python-...@googlecode.com

unread,
Jun 13, 2013, 4:14:42 PM6/13/13
to python-twi...@googlegroups.com

Comment #10 on issue 144 by ben....@gmail.com: AttributeError: 'unicode'
I had code that worked perfectly until yesterday. Now
tweeter.GetUserTimeline(settings.TWITTER_USER) is throwing this error.

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

python-...@googlecode.com

unread,
Jun 13, 2013, 6:43:09 PM6/13/13
to python-twi...@googlegroups.com

Comment #11 on issue 144 by bear42: AttributeError: 'unicode' object has no
attribute 'get'
http://code.google.com/p/python-twitter/issues/detail?id=144

I just tested the latest from github with a known good set of credentials
and

api.GetUserTimeline(foo)

works for me - can you provide more info about what version this is and
what version of Python

python-...@googlecode.com

unread,
Jul 1, 2013, 6:05:14 PM7/1/13
to python-twi...@googlegroups.com

Comment #12 on issue 144 by ndep...@alumni.nd.edu:
AttributeError: 'unicode' object has no attribute 'get'
http://code.google.com/p/python-twitter/issues/detail?id=144

I'm getting this error in python 2.7.2

python-...@googlecode.com

unread,
Aug 2, 2013, 9:13:56 AM8/2/13
to python-twi...@googlegroups.com

Comment #13 on issue 144 by pjsmyth....@gmail.com:
AttributeError: 'unicode' object has no attribute 'get'
http://code.google.com/p/python-twitter/issues/detail?id=144

Hey Bear

Python v 2.7.5
c:\python27\lib\site-packages\python_twitter-0.8.2-py2.7.egg\twitter.py

I too am getting the following error:

Traceback (most recent call last):

File "C:\Python27\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py",
line 326, in RunScript
exec codeObject in __main__.__dict__
File "D:\Python\twitter1.py", line 7, in <module>
statuses = api.GetPublicTimeline()
File "build\bdist.win-amd64\egg\twitter.py", line 2301, in
GetPublicTimeline
return [Status.NewFromJsonDict(x) for x in data]
File "build\bdist.win-amd64\egg\twitter.py", line 620, in NewFromJsonDict
return Status(created_at=data.get('created_at', None),
AttributeError: 'unicode' object has no attribute 'get'

____________________________________________________________________________________________
My code:

import twitter
api = twitter.Api(consumer_key='consumer_key',
consumer_secret='consumer_secret',
access_token_key='access_token_key',
access_token_secret='access_token_secret')

statuses = api.GetPublicTimeline()
print [s.user.name for s in statuses]

python-...@googlecode.com

unread,
Aug 2, 2013, 9:16:46 AM8/2/13
to python-twi...@googlegroups.com

Comment #14 on issue 144 by pjsmyth....@gmail.com:
AttributeError: 'unicode' object has no attribute 'get'
http://code.google.com/p/python-twitter/issues/detail?id=144

sorry but getting same eror with GetUserTimeline as well
Reply all
Reply to author
Forward
0 new messages