From 145492690b3c96fe521cb9281764d15fc13c3695 Mon Sep 17 00:00:00 2001 From: Lynne Date: Tue, 13 Nov 2018 21:14:57 +1000 Subject: [PATCH] fix bug ocurring when user has no cc posts, only request a single post for ccc_a --- web.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web.py b/web.py index 63ef980..feed702 100755 --- a/web.py +++ b/web.py @@ -193,7 +193,7 @@ def cc_connect(): @app.route('/internal/ccc_a', methods=['POST']) def ccc_a(): #step one of curiouscat connection: retreive details - r = requests.get("https://curiouscat.me/api/v2/profile?username={}".format(request.form['cc'])) + r = requests.get("https://curiouscat.me/api/v2/profile?username={}&count=1".format(request.form['cc'])) j = r.json() if 'error' in j: return redirect('/cc_connect?invalid') @@ -201,7 +201,7 @@ def ccc_a(): #step one of curiouscat connection: retreive details "cc":j['userData']['username'], "ccavi":j['userData']['avatar'], "ccid":j['userData']['id'], - "latest_post":j['posts'][0]['timestamp'] #only post new answers from this point onwards, rather than posting all the old ones + "latest_post":j['posts'][0]['timestamp'] if len(j['posts']) != 0 else 0 #only post new answers from this point onwards, rather than posting all the old ones } return redirect('/cc_connect/confirm')