def timeline(app, user, args): generator = get_timeline_generator(app, user, args) while (True): try: items = next(generator) except StopIteration: print_out("That's all folks.") return if args.account and args.yes: sleep(5) if args.reverse: items = reversed(items) print_timeline(items, format=args.format) if args.once: break if args.yes: continue char = input("\nContinue? [Y/n] ") if char.lower() == "n": break
def thread(app, user, args): toot = api.single_status(app, user, args.status_id) context = api.context(app, user, args.status_id) thread = [] for item in context['ancestors']: thread.append(item) thread.append(toot) for item in context['descendants']: thread.append(item) print_timeline(thread)
def timeline(app, user, args): # Make sure tag, list and public are not used simultaneously if len([arg for arg in [args.tag, args.list, args.public] if arg]) > 1: raise ConsoleError( "Only one of --public, --tag, or --list can be used at one time.") if args.local and not (args.public or args.tag): raise ConsoleError( "The --local option is only valid alongside --public or --tag.") if args.public: gen = api.public_timeline_generator(app.instance, local=args.local, limit=args.count) elif args.tag: gen = api.tag_timeline_generator(app, user, args.tag, local=args.local, limit=args.count) elif args.list: gen = api.timeline_list_genertor(app, user, args.list) else: gen = api.home_timeline_generator(app, user, limit=args.count) while (True): items = next(gen) if args.reverse: items = reversed(items) print_timeline(items) if args.once: break char = input("\nContinue? [Y/n] ") if char.lower() == "n": break
def timeline(app, user, args): # Make sure tag, list and public are not used simultaneously if len([arg for arg in [args.tag, args.list, args.public] if arg]) > 1: raise ConsoleError( "Only one of --public, --tag, or --list can be used at one time.") if args.local and not (args.public or args.tag): raise ConsoleError( "The --local option is only valid alongside --public or --tag.") if args.public: items = api.timeline_public(app, user, local=args.local) elif args.tag: items = api.timeline_tag(app, user, args.tag, local=args.local) elif args.list: items = api.timeline_list(app, user, args.list) else: items = api.timeline_home(app, user) if args.reverse: items = reversed(items) print_timeline(items)
def timeline(app, user, args): generator = get_timeline_generator(app, user, args) while(True): try: items = next(generator) except StopIteration: print_out("That's all folks.") return if args.reverse: items = reversed(items) if "json" in args : print( json.dumps( items ) ) else: print_timeline(items) if args.once: break char = input("\nContinue? [Y/n] ") if char.lower() == "n": break