import threading
import requests
import webbrowser
+import traceback
from twitter.stream import TwitterStream, Timeout, HeartbeatTimeout, Hangup
from twitter.api import *
'-ig',
'--ignore',
help='Ignore specific screen_name.')
+ parser.add_argument(
+ '-dg',
+ '--debug',
+ action='store_true',
+ help='Run in debug mode.')
parser.add_argument(
'-iot',
'--image-on-term',
return screen_name_list
+def debug_option():
+ """
+ Save traceback when run in debug mode
+ """
+ if g['debug']:
+ g['traceback'].append(traceback.format_exc())
+
+
def init(args):
"""
Init function
g['events'] = []
# Startup cmd
g['cmd'] = ''
+ # Debug option
+ g['debug'] = args.debug
+ g['traceback'] = []
# Retweet of mine events
c['events'] = []
# Semaphore init
include_entities=False)
show_profile(user)
except:
- printNicely(red('Omg no user.'))
+ debug_option()
+ printNicely(red('No user.'))
else:
printNicely(red('A name should begin with a \'@\''))
img = Image.open(BytesIO(res.content))
img.show()
except:
+ debug_option()
printNicely(red('Sorry I can\'t show this image.'))
for link in link_ary:
webbrowser.open(link)
except:
+ debug_option()
printNicely(red('Sorry I can\'t open url in this tweet.'))
g['original_name'],
g['full_name'])
except Exception:
+ debug_option()
printNicely(red('No such thread.'))
else:
printNicely(red('A name should begin with a \'@\''))
except:
+ debug_option()
printNicely(red('Sorry I can\'t understand.'))
else:
printNicely(red(rel))
except:
+ debug_option()
printNicely(red('Something is wrong, can not mute now :('))
else:
printNicely(red('A name should begin with a \'@\''))
screen_name=user_name)
printNicely(green('Added.'))
except:
+ debug_option()
printNicely(light_magenta('I\'m sorry we can not add him/her.'))
screen_name=user_name)
printNicely(green('Gone.'))
except:
+ debug_option()
printNicely(light_magenta('I\'m sorry we can not remove him/her.'))
owner_screen_name=owner)
printNicely(green('Done.'))
except:
+ debug_option()
printNicely(
light_magenta('I\'m sorry you can not subscribe to this list.'))
owner_screen_name=owner)
printNicely(green('Done.'))
except:
+ debug_option()
printNicely(
light_magenta('I\'m sorry you can not unsubscribe to this list.'))
description=description)
printNicely(green(name + ' list is created.'))
except:
+ debug_option()
printNicely(red('Oops something is wrong with Twitter :('))
description=description)
printNicely(green(slug + ' list is updated.'))
except:
+ debug_option()
printNicely(red('Oops something is wrong with Twitter :('))
owner_screen_name=g['original_name'])
printNicely(green(slug + ' list is deleted.'))
except:
+ debug_option()
printNicely(red('Oops something is wrong with Twitter :('))
except EOFError:
printNicely('')
except Exception:
+ debug_option()
printNicely(red('OMG something is wrong with Twitter right now.'))