From d7f9a309b1fc570e7e9caa554974bbbd8d8cce43 Mon Sep 17 00:00:00 2001 From: Lynne Date: Tue, 13 Nov 2018 22:03:57 +1000 Subject: [PATCH] added __main__ stuff --- run.py | 6 +++--- web.py | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/run.py b/run.py index 916bfc1..dd47fe0 100755 --- a/run.py +++ b/run.py @@ -32,15 +32,15 @@ for row in dc.fetchall(): client = Mastodon(client_id=row['client_id'], client_secret=row['client_secret'], access_token=row['secret'], api_base_url=row['instance']) for post in j['posts']: if post['senderData']['id'] == False: - sender = "Anonymous user" + sender = "(anonymous)" else: sender = post['senderData']['username'] if int(post['timestamp']) == int(row['latest_post']): #this is the one we've already seen continue - - toot = "Curious cat question from {}: \"{}\"\nMy answer: {}\nView online at https://curiouscat.me/{}/post/{}".format(sender, post['comment'], post['reply'], row['cc'], post['id']) #TODO: what if this is over 500 characters? + + toot = "Curious cat user {} asks: {}\nMy answer: {}\nView online at https://curiouscat.me/{}/post/{}".format(sender, post['comment'], post['reply'], row['cc'], post['id']) #TODO: what if this is over 500 characters? if settings['cw']: client.status_post(toot, spoiler_text="Curious Cat post") else: diff --git a/web.py b/web.py index 8948b8c..9f9f0f8 100755 --- a/web.py +++ b/web.py @@ -244,3 +244,6 @@ def ccc_c(): @app.route('/cc_connect/complete') def cc_connect_complete(): return render_template('cc_connect_complete.html', bg="background-image:url('{}')".format(session['ccavi'])) + +if __name__ == "__main__": + app.run(host="0.0.0.0", port=4734) #4734 is t9 for 'greg' \ No newline at end of file