A modelization of a tweet object with convenient features and functionalities
Project description
Tweet Model
A modelization of a tweet object with convenient features and functionalities. This project was thought for integration and usage as a package by the Twitter Dashboard project.
Free software: MIT license
Documentation: https://tweet-model.readthedocs.io.
Features
A modelization of a tweet in the form of class Tweet. This class contains a constructor that initializes all the possible tweet attributes to None except those indicated otherwise.
The inner objects of a tweet (“user”, “entities”, “places”, etc.) are stored internally as nested dictionaries.
The __getitem__() method for Tweet is overriden to allow a dictionary-like access to the tweet contents. For example, if “tweet1” is an instance of Tweet, one could do tweet1[“id”] to get the id of that tweet, or tweet1[“user”][“name”] to get the name of the person that published the tweet.
Credits
Creator: Sergio
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
History
0.1.0 (2019-03-13)
First release on PyPI.
0.2.0 (2019-03-20)
Completed the Tweet class that allows the user to make usable instances of a tweet model. Includes initialization of all the Tweet attributes indicated in the Twitter documentation (default to None, unless the user provides a value) and overriding of __getitem__ to provide a dictionary-like access to the information.
0.3.0 (2019-03-20)
Added method “get_tweets_from_csv()”, which gets a CSV file as an argument and returns a list containing as many Tweet objects as lines (minus the header) in the CSV file. The header of the CSV is used to know which attributes should be set.
The method will raise an error and exit if any item in the header does not match with the specification of the Tweet object (for example, the header word “media.sizes.thumb.h” would be valid, but “user.lightsaber.color” would not.
At this point, the method took 1.75s aprox to read and return the contents of a 5.7 MB as a list of ‘Tweet’s. This could be troublesome with very large collections in a future if the progression of time was proportional with the file size (estimation would be 25 minutes for a 5 GB file)
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
Built Distribution
Hashes for tweet_model_serpucga-0.3.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5abf563a7951b340d096a47476b29777b6a5a94487664bfa05dce5346f568b6b |
|
MD5 | 9d99f90dfd1cb2783cb0e94b6867dba0 |
|
BLAKE2b-256 | b948515076cf8f453017f65159adaaf25b278179b2af79f46c182e152beb3609 |
Hashes for tweet_model_serpucga-0.3.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a18857a698527784fc727e6c35c0817118ee06ddb54398e54b0ae819b493f665 |
|
MD5 | 20ab67683994a11c28297c60aa124a51 |
|
BLAKE2b-256 | 11fef53cd4f3d93f73ba4a80b83815a53d45f9661ef1d747b53cd0ea04fd02d7 |