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

2024-09-30 19:35:31 发布

您现在位置:Python中文网/ 问答频道 /正文

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

ConnectionError:HTTPConnectionPool(host='backup.grammabot.io',port=80):url超过最大重试次数:/v2/check?language=en US&;text=I+cant+member+how+to+go+the&;api_key=python默认值(由NewConnectionError('0x00000186FCF86A00处的<;urllib3.connection.HTTPConnection对象引起):未能建立新连接:[Errno 11001]getaddrinfo失败])

这是我的密码:

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

请帮帮我


Tags: keytextclientcheckresrulelanguagelength