Skip to content

Instantly share code, notes, and snippets.

@otiai10
Last active December 20, 2015 01:18
Show Gist options
  • Save otiai10/6047649 to your computer and use it in GitHub Desktop.
Save otiai10/6047649 to your computer and use it in GitHub Desktop.
tweet class constructions
-------------- tw ------------------
friends
-------------- tw ------------------
lang
truncated
created_at
text
coordinates
in_reply_to_status_id_str
source
entities
in_reply_to_user_id
favorite_count
id
id_str
favorited
contributors
place
retweeted
in_reply_to_status_id
filter_level
in_reply_to_screen_name
user
retweet_count
geo
in_reply_to_user_id_str
<class 'twitter.api.wrap_response.<locals>.WrappedTwitterResponse'>
>>>>>>>>>>>>>>>>>>>>>>>>>>>property bellow is the first objecti coming into streaming API
------------
friends
[140021552, 136241877, 128187038, 146322111]
>>>>>>>>>>>>>>>>>>>>>>>>>>>property bellow is the main tweets coming into streaming API
<class 'twitter.api.wrap_response.<locals>.WrappedTwitterResponse'>
------------
retweet_count
0
------------
coordinates
None
------------
favorited
False
------------
text
@hisyotan test002
------------
place
None
------------
in_reply_to_screen_name
hisyotan
------------
filter_level
medium
------------
in_reply_to_status_id
None
------------
in_reply_to_user_id_str
971441053
------------
contributors
None
------------
id_str
358828572191883264
------------
lang
tl
------------
entities
{'hashtags': [], 'urls': [], 'user_mentions': [{'id': 971441053, 'id_str': '971441053', 'screen_name': 'hisyotan', 'name': 'hisyotan', 'indices': [0, 9]}], 'symbols': []}
------------
retweeted
False
------------
source
<a href="http://itunes.apple.com/us/app/twitter/id409789998?mt=12" rel="nofollow">Twitter for Mac</a>
------------
id
358828572191883264
------------
truncated
False
------------
favorite_count
0
------------
in_reply_to_user_id
971441053
------------
created_at
Sun Jul 21 05:59:32 +0000 2013
------------
user
Traceback (most recent call last):
File "/home/hiromu/prj/python/hisyotan/app.py", line 4, in <module>
hisyotan.listen()
File "/home/hiromu/prj/python/hisyotan/skel/base.py", line 48, in listen
tw = util.convert_twitter_format(t)
File "/home/hiromu/prj/python/hisyotan/system/util.py", line 8, in convert_twitter_format
return _convert_v0(tw)
File "/home/hiromu/prj/python/hisyotan/system/util.py", line 15, in _convert_v0
print(v)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 73-82: ordinal not in range(128)
# the value of user field might be Japanese char?
# encode('utf8')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment