Skip to main content

tweettr is a `attrdict` like wrapper around (a few) Twitter JSON objects.

Project description

Tweettr - thin attrdict like wrapper around (a few) Tweet objects

PyPI PyPI - Downloads MIT license GitHub issues Github Sponsors

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


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 details)

Uploaded Source

Built Distribution

tweettr-0.1.0-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file tweettr-0.1.0.tar.gz.

File metadata

  • Download URL: tweettr-0.1.0.tar.gz
  • Upload date:
  • Size: 15.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0.post20200102 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.8.1

File hashes

Hashes for tweettr-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e7334eeb8808f485e49317ea467be39571c9408bc1ffc96d5008722a9bd5ae29
MD5 7a7d42e4d4275ded0dc0021ff0f6de34
BLAKE2b-256 1b4652e7774c4329e1c0680f161981898eb40ae4c2ea0c34359e37e8e521267c

See more details on using hashes here.

File details

Details for the file tweettr-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: tweettr-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0.post20200102 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.8.1

File hashes

Hashes for tweettr-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 055b1d6a6d50fd2a4bfa3052f1b5bb517cf4672ad4b639fff1e1f8742bb53681
MD5 255bebe624c80b0813bf6570691f3278
BLAKE2b-256 c20a020e21028a83e1e0a9a69e6567b3765175b0343c70eb875156e1f09ed8e7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page