GeometrizeTwitterBot  1.0
Python Twitter bot for geometrizing images into geometric primitives
Functions | Variables
bot Namespace Reference

Module that sets up the Geometrize Twitter bot. More...

Functions

def on_connect (api)
 Callback triggered when the stream listener connects. More...
 
def on_timeout (api)
 Callback triggered when the stream listener times out. More...
 
def on_error (api, code)
 Callback triggered when the listener encounters an error. More...
 
def on_on_demand_status_event (api, status)
 Callback triggered when the stream listener for the Geometrize bot account reports a status event. More...
 
def on_account_watcher_status_event (api, status)
 Callback triggered when the stream listener for tracking specific Twitter accounts reports a status event. More...
 
def on_on_demand_filter_setup (stream)
 Callback triggered when setting up the stream filter for tracking the Geometrize bot account. More...
 
def on_account_watcher_filter_setup (stream)
 Callback triggered when setting up the stream filter for tracking specific Twitter accounts. More...
 

Variables

 tweepy_auth = tweepy.OAuthHandler(config.OAUTH_CONSUMER_KEY, config.OAUTH_CONSUMER_SECRET)
 
 tweepy_api = tweepy.API(tweepy_auth)
 
 on_demand_bot
 
 account_watcher_bot
 

Detailed Description

Module that sets up the Geometrize Twitter bot.

Invoke this script to run the bot i.e. "python bot.py".

Function Documentation

◆ on_account_watcher_filter_setup()

def bot.on_account_watcher_filter_setup (   stream)

Callback triggered when setting up the stream filter for tracking specific Twitter accounts.

73  print("Setting up account watcher tweet filter...")
74  stream.filter(follow = config.TWITTER_BOT_WATCH_ACCOUNTS, is_async = True)
75 
76 # Create and set up the on-demand Geometrize bot.
77 # This bot waits for users to tweet images at the bot, which it then geometrizes.

◆ on_account_watcher_status_event()

def bot.on_account_watcher_status_event (   api,
  status 
)

Callback triggered when the stream listener for tracking specific Twitter accounts reports a status event.

62 def on_account_watcher_status_event(api, status):
63  print("Received Twitter stream listener status event")
65 
Here is the call graph for this function:

◆ on_connect()

def bot.on_connect (   api)

Callback triggered when the stream listener connects.

43 def on_connect(api):
44  print("Twitter stream listener did connect")
45 

◆ on_error()

def bot.on_error (   api,
  code 
)

Callback triggered when the listener encounters an error.

52 def on_error(api, code):
53  print("Encountered Twitter error response: %s" % code)
54  return True
55 

◆ on_on_demand_filter_setup()

def bot.on_on_demand_filter_setup (   stream)

Callback triggered when setting up the stream filter for tracking the Geometrize bot account.

67 def on_on_demand_filter_setup(stream):
68  print("Setting up on demand tweet filter...")
69  stream.filter(track = [config.TWITTER_BOT_USERNAME], is_async = True)
70 

◆ on_on_demand_status_event()

def bot.on_on_demand_status_event (   api,
  status 
)

Callback triggered when the stream listener for the Geometrize bot account reports a status event.

57 def on_on_demand_status_event(api, status):
58  print("Received Twitter stream listener status event")
60 
Here is the call graph for this function:

◆ on_timeout()

def bot.on_timeout (   api)

Callback triggered when the stream listener times out.

47 def on_timeout(api):
48  print("Twitter stream listener did time out")
49  return False
50 

Variable Documentation

◆ account_watcher_bot

bot.account_watcher_bot
Initial value:
2  tweepy_auth,
3  tweepy_api,
4  on_connect,
5  on_timeout,
6  on_error,
7  on_account_watcher_status_event,
8  on_account_watcher_filter_setup)

◆ on_demand_bot

bot.on_demand_bot
Initial value:
2  tweepy_auth,
3  tweepy_api,
4  on_connect,
5  on_timeout,
6  on_error,
7  on_on_demand_status_event,
8  on_on_demand_filter_setup)

◆ tweepy_api

bot.tweepy_api = tweepy.API(tweepy_auth)

◆ tweepy_auth

bot.tweepy_auth = tweepy.OAuthHandler(config.OAUTH_CONSUMER_KEY, config.OAUTH_CONSUMER_SECRET)
geometrize_bot.GeometrizeBot
Definition: geometrize_bot.py:8
on_status_event.on_account_watcher_status_event
def on_account_watcher_status_event(api, status)
Handles a status change event from the Twitter streaming API.
Definition: on_status_event.py:122
bot.on_timeout
def on_timeout(api)
Callback triggered when the stream listener times out.
Definition: bot.py:47
bot.on_on_demand_filter_setup
def on_on_demand_filter_setup(stream)
Callback triggered when setting up the stream filter for tracking the Geometrize bot account.
Definition: bot.py:67
on_status_event.on_on_demand_status_event
def on_on_demand_status_event(api, status)
Handles a status change event from the Twitter streaming API.
Definition: on_status_event.py:64
bot.on_account_watcher_filter_setup
def on_account_watcher_filter_setup(stream)
Callback triggered when setting up the stream filter for tracking specific Twitter accounts.
Definition: bot.py:72
bot.on_account_watcher_status_event
def on_account_watcher_status_event(api, status)
Callback triggered when the stream listener for tracking specific Twitter accounts reports a status e...
Definition: bot.py:62
bot.on_on_demand_status_event
def on_on_demand_status_event(api, status)
Callback triggered when the stream listener for the Geometrize bot account reports a status event.
Definition: bot.py:57
bot.on_connect
def on_connect(api)
Callback triggered when the stream listener connects.
Definition: bot.py:43
bot.on_error
def on_error(api, code)
Callback triggered when the listener encounters an error.
Definition: bot.py:52