From b604e5ee140c219e6f0ce7386adb6f71249771d0 Mon Sep 17 00:00:00 2001 From: SouthFox Date: Tue, 2 Aug 2022 03:24:02 +0800 Subject: [PATCH] utils: Fix lint --- utils.py | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/utils.py b/utils.py index 8a91418..9f6489c 100644 --- a/utils.py +++ b/utils.py @@ -61,31 +61,32 @@ def addDiscussion(): if r.status_code == 200: discussions = r.json() - discussions = discussions["data"]["repository"]["discussions"]["nodes"] + discussions = discussions["data"]["repository"]["discussions"]["nodes"] - discu_list = [] - for i in discussions: - discu_list.append(i["title"]) + discu_list = [] + for i in discussions: + discu_list.append(i["title"]) - for post in postlist: - if currentYear not in post: - continue + for post in postlist: + if currentYear not in post: + continue - if post not in discu_list: - data = { - 'query': """mutation{ - createDiscussion(input: {repositoryId: "%s", categoryId: "%s", body: "%s", title: "%s"}) { - discussion { - id + if post not in discu_list: + data = { + 'query': """mutation{ + createDiscussion(input: {repositoryId: "%s", categoryId: "%s", body: "%s", title: "%s"}) { + discussion { + id + } } - } - }""" % (repo_id, category_id, 'https://blog.southfox.me/' + post, post) - } + }""" % (repo_id, category_id, 'https://blog.southfox.me/' + post, post) + } - r = requests.post(url, headers=header, data=json.dumps(data)) - if r.status_code == 200: - print(f"初始化对应讨论! {post}") - print(r.text) + r = requests.post(url, headers=header, data=json.dumps(data)) + if r.status_code == 200: + print(f"==========\n初始化对应讨论! {post}\n==========") + else: + print("错误!") def backupImg(): path = os.getcwd()