Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit 96705b7

Browse files
committed
fix cxmooc and www150
1 parent e7e044e commit 96705b7

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

api.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ async def cxmooc_tool(sess: requests.Session,
2929
sess = requests.Session()
3030

3131
# 接口
32-
url = "https://blog.icodef.com:8081/v2/answer"
32+
url = "https://cx.icodef.com/v2/answer"
3333

3434
# 接口参数
3535
index = yield
@@ -296,9 +296,11 @@ async def www150s(sess: requests.Session,
296296
res = res.json()
297297
answer = []
298298
temp = {}
299-
temp['topic'] = res['title']
300-
temp['correct'] = res['answer']
301-
if temp['topic'] != "查无此题,请您换一道题查询!":
299+
for each in res:
300+
temp['topic'] = each['title']
301+
temp['correct'] = each['answer']
302+
if temp['topic'] == "查无此题,请您换一道题查询!":
303+
break
302304
answer.append(temp)
303305
logging.info("Yield question %s: %s" % (i+1, answer))
304306
index = yield answer

app.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,10 @@ async def search(self, frame_list):
542542
for generator in generator_list.keys():
543543
label.insert(END, f"查询中。。。使用源{generator}\n")
544544
label.configure(state="disable")
545-
result = await generator_list[generator].asend(i)
545+
try:
546+
result = await generator_list[generator].asend(i)
547+
except Exception as e:
548+
logging.error(repr(e))
546549
label.configure(state="normal")
547550
if result and result[0]['correct']:
548551
for answer in result:

0 commit comments

Comments
 (0)