连接API的时候报错,昨天还能用没改动代码,报错位置:
Traceback (most recent call last):
File "C:/Users/vbove/PycharmProjects/AnswerHero/start.py", line 67, in
get_results(cnt)
File "C:/Users/vbove/PycharmProjects/AnswerHero/start.py", line 37, in get_results
search = client.basicGeneral(ques)
File "C:\Users\vbove\PycharmProjects\AnswerHero\venv\lib\site-packages\aip\ocr.py", line 66, in basicGeneral
return self._request(self.__generalBasicUrl, data)
File "C:\Users\vbove\PycharmProjects\AnswerHero\venv\lib\site-packages\aip\base.py", line 89, in _request
authObj = self._auth()
File "C:\Users\vbove\PycharmProjects\AnswerHero\venv\lib\site-packages\aip\base.py", line 165, in _auth
), proxies=self._proxies).json()
File "C:\Users\vbove\PycharmProjects\AnswerHero\venv\lib\site-packages\requests\api.py", line 72, in get
return request('get', url, params=params, **kwargs)
File "C:\Users\vbove\PycharmProjects\AnswerHero\venv\lib\site-packages\requests\api.py", line 58, in request
return session.request(method=method, url=url, **kwargs)
File "C:\Users\vbove\PycharmProjects\AnswerHero\venv\lib\site-packages\requests\sessions.py", line 508, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\vbove\PycharmProjects\AnswerHero\venv\lib\site-packages\requests\sessions.py", line 618, in send
r = adapter.send(request, **kwargs)
File "C:\Users\vbove\PycharmProjects\AnswerHero\venv\lib\site-packages\requests\adapters.py", line 440, in send
timeout=timeout
File "C:\Users\vbove\PycharmProjects\AnswerHero\venv\lib\site-packages\urllib3\connectionpool.py", line 601, in urlopen
chunked=chunked)
File "C:\Users\vbove\PycharmProjects\AnswerHero\venv\lib\site-packages\urllib3\connectionpool.py", line 346, in _make_request
self._validate_conn(conn)
File "C:\Users\vbove\PycharmProjects\AnswerHero\venv\lib\site-packages\urllib3\connectionpool.py", line 850, in _validate_conn
conn.connect()
File "C:\Users\vbove\PycharmProjects\AnswerHero\venv\lib\site-packages\urllib3\connection.py", line 314, in connect
cert_reqs=resolve_cert_reqs(self.cert_reqs),
File "C:\Users\vbove\PycharmProjects\AnswerHero\venv\lib\site-packages\urllib3\util\ssl_.py", line 269, in create_urllib3_context
context.options |= options
File "E:\Program Files (x86)\Python36-32\lib\ssl.py", line 459, in options
super(SSLContext, SSLContext).options.__set__(self, value)
File "E:\Program Files (x86)\Python36-32\lib\ssl.py", line 459, in options
super(SSLContext, SSLContext).options.__set__(self, value)
File "E:\Program Files (x86)\Python36-32\lib\ssl.py", line 459, in options
super(SSLContext, SSLContext).options.__set__(self, value)
[Previous line repeated 322 more times]
RecursionError: maximum recursion depth exceeded while calling a Python object
问一下win下的SDS怎么下载?
你好 win下的sdk怎么下载?下载怎么使用?
找到错了,我下了一个并发的grequests模块,里面有从requests导入session,sdk也导入了,然后可能一直循环导入,报的错也是递归层数过多,我把两个导入位置换了一下就没问题了,但是还是不太清楚具体原理
因为我不是搞Python的。看不懂你的代码想做什么。用SDK调用通用OCR接口是没啥问题的。
可以和我的代码对比一下:
识别的结果:
我把search那行后面全注释了仍然报错,就是用sdk调用api那行,后来我手写调用api仍然报的一样的错,ques是图片没有问题,昨天还能用,今天就不行了,是不是baidu的问题?
代码能完整吗?看你的那一行大概知道是SDK调用。Python SDK我也试过没问题呀。还很简单。
这一行报错,是通用文字识别接口
你写的代码在哪?到底是SDK还是API调用?具体是哪个接口