Browse Source

fix bug ocurring when user has no cc posts, only request a single post for ccc_a

master
Lynne Megido 1 year ago
parent
commit
145492690b
Signed by: Lynne <thecoolone3@gmail.com> GPG Key ID: FB7B970303ACE499
1 changed files with 2 additions and 2 deletions
  1. 2
    2
      web.py

+ 2
- 2
web.py View File

@@ -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')


Loading…
Cancel
Save