From 119a6b96132ffb1c1ec250811f14e8c5a279ecc6 Mon Sep 17 00:00:00 2001 From: buckket Date: Wed, 27 Sep 2017 00:38:39 +0200 Subject: [PATCH] Fixing two minor bugs * Check if status actually contains something (it won't when the request failed) * UnboundLocalError, oh please how could I forgot --- twtxt/cli.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/twtxt/cli.py b/twtxt/cli.py index e085894..8881f7b 100644 --- a/twtxt/cli.py +++ b/twtxt/cli.py @@ -131,6 +131,8 @@ def timeline(ctx, pager, limit, twtfile, sorting, timeout, porcelain, source, ca else: sources = ctx.obj["conf"].following + tweets = [] + if cache: try: with Cache.discover(update_interval=ctx.obj["conf"].timeline_update_interval) as cache: @@ -238,7 +240,7 @@ def follow(ctx, nick, url, force): click.style(source.nick, bold=True)), default=False, abort=True) _, status = get_remote_status([source])[0] - if status != 200: + if not status or status.status_code != 200: click.confirm("➤ The feed of {0} at {1} is not available. Follow anyway?".format( click.style(source.nick, bold=True), click.style(source.url, bold=True)), default=False, abort=True)