From e5298bda9ac9580ca52672932375b1d19b962a1e Mon Sep 17 00:00:00 2001 From: monster <1@2.3> Date: Fri, 17 Dec 2021 21:01:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=BE=E5=BC=80=E7=A7=8D=E7=B1=BB=E9=99=90?= =?UTF-8?q?=E5=88=B6=EF=BC=8C=E4=BC=98=E5=8C=96=E6=98=BE=E7=A4=BA=E6=95=88?= =?UTF-8?q?=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index 4c059da..13e5412 100644 --- a/main.py +++ b/main.py @@ -33,16 +33,16 @@ def getClock(now): ['c', 'k'], ] # 见https://developer.hitokoto.cn/sentence/#%E8%BF%94%E5%9B%9E%E6%A0%BC%E5%BC%8F try: - r = requests.get(sentence_api, params=params) + r = requests.get(sentence_api) # 增加趣味性,不限制种类了 data = r.json() except Exception as e: print(e) - data = None + data = '' if data: hitokoto = data['hitokoto'] place = data['from'] - author = data['from_who'] - sentence = f'{hitokoto}\n ——{author}《{place}》' + author = data['from_who'] or '' + sentence = f'>{hitokoto}\n>            ——{author}《{place}》' else: sentence = ''