HTTPConnectionPool(host='backup.grammarbot.io', port=80):url 超过最大重试次数:

时间:2021-03-13 05:26:02

标签: python api

我正在尝试在 python 中使用语法机器人 API,但它给出了这个错误。

ConnectionError: HTTPConnectionPool(host='backup.grammarbot.io', port=80): Max retries exceeded with url: /v2/check?language=en-US&text=I+cant+remember+how+to+go +their&api_key=python-default(由 NewConnectionError 引起(':无法建立新连接:[Errno 11001] getaddrinfo failed'))

这是我的代码:

from grammarbot import GrammarBotClient
client = GrammarBotClient()
client = GrammarBotClient(api_key='Api_key')
client = GrammarBotClient(base_uri='http://backup.grammarbot.io:80')
text = 'I cant remember how to go their'
res = client.check(text)
# check detected language
res.detected_language # "en-US"

# check if the result is incomplete
res.result_is_incomplete # False
res.matches

res = client.check(text) # GrammarBotApiResponse(matches=[GrammarBotMatch(offset=2, length=4, rule={'CANT'}, category={'TYPOS'}), GrammarBotMatch(offset=26, length=5, rule={'CONFUSION_RULE'}, category={'TYPOS'})])

res.detected_language

res.result_is_incomplete
res.matches # [GrammarBotMatch(offset=2, length=4, rule={'CANT'}, category={'TYPOS'}), GrammarBotMatch(offset=26, length=5, rule={'CONFUSION_RULE'}, category={'TYPOS'})]
match0= match[0] 
match0.replacement_offset # 2
match0.replacement_length # 4

match0.replacements 
match0.corrections
match0.rule
match0.category
match0.type
match0.message

请帮帮我。

0 个答案:

没有答案
相关问题