tweets
django module¶
Twitter posts module.
This module has two processes:
twitter_stream
, opens a TCP socket to the user streaming endpoint and insert new posts as they are pushed by twitter’s endpoint, one thread perTwitterAccount
.twitter_retweets
, insert new stats for recent posts.
Management commands: creating data¶
twitter_retweets
¶
Background command to create Stat for twitter Posts.
Poll the Twitter post list api with the list of post ids for posts we want to update stat for.
Run with:
buzzdetect twitter_retweets
twitter_stream
¶
Connect to twitter’s stream API and maintain database in sync.
The twitter_stream command run continuously in the background to insert new tweets, retweets, and friends.
This management command follows one twitter account per thread. Then, spawns a thread per twitter stream api message received.
Run with:
buzzdetect twitter_stream
AppConfig: Twitter specific config¶
AppConfig for this module.
-
class
tweets.apps.
TweetsConfig
(app_name, app_module)[source]¶ Twitter specific global config.
-
account
= 'twitteraccount'¶
-
account_create_url
= <django.utils.functional.__proxy__ object>¶
-
loggers
= (('tweets.stream', 'Post insert'), ('tweets.retweets', 'Post stat'))¶
-
name
= 'tweets'¶
-
pk
= 1¶
-
poster_stat_per_kind
= False¶
-
score_unit
= 'retweet'¶
-
score_unit_plural
= 'retweets'¶
-
time_unit
= 'minute'¶
-
verbose_name
= 'Twitter'¶
-
Models¶
Models for the tweets module.
The naming is a bit unfortunate, but the twitter
namespace is already
taken as shows the import list.
-
class
tweets.models.
TwitterAccount
(*args, **kwargs)[source]¶ Account child for this module.
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
account_ptr
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
account_ptr_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
consumer_key
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
consumer_secret
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
objects
= <django.db.models.manager.Manager object>¶
-
secret
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
token
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exception