tweettr is a `attrdict` like wrapper around (a few) Twitter JSON objects.
Project description
Tweettr - thin attrdict like wrapper around (a few) Tweet objects
Tweettr gives you a convenient attribute interface to (some) tweet objects without any copying overhead. And if your editor or IDE understands type annotations it let's you do attribute auto completion.
It also add a way to provide emoji parsing with a similar interface to .entities.hashtags
. :sparkling_heart:
So when you receive a json object from the twitter streaming api you can access it in a nicer way:
# json blob returned from twitter streaming api
{
"id": 11223344556677889900,
"id_str": "11223344556677889900",
"created_at": "Sun Feb 16 13:16:19 +0000 2020",
"user": {
"id": 11223344556677889900,
"id_str": "11223344556677889900",
"screen_name": "AAAAAAAA",
# ...
},
"entities": {
"hashtags": [{
"indices": [12, 21],
"text": "MyHashTag"
}]
},
"text": "Hello World #MyHashTag",
"favorite_count": 0,
"favorited": false,
"timestamp_ms": "1500000000000",
"truncated": false,
# ...
}
becomes:
>>> import tweettr
>>> tweet = tweettr.Tweet(json_blob)
>>> tweet.user.id
11223344556677889900
>>> tweet.user.screen_name
'AAAAAAAA'
>>> tweet.emojis # extract emojis like HashTags and Urls...
[Emoji(...), Emoji(...)]
>>> ... # etc, etc...
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
tweettr-0.1.0.tar.gz
(15.9 kB
view hashes)
Built Distribution
tweettr-0.1.0-py3-none-any.whl
(10.8 kB
view hashes)