18870 / chatgpt-proxy

A ChatGPT unofficial API proxy written in Python.
GNU Affero General Public License v3.0
15 stars 4 forks source link

运行的时候报错,是为什么呢? #2

Closed yayaQAQ closed 1 year ago

yayaQAQ commented 1 year ago

python3 -m chatgpt_proxy INFO: Started server process [45020] INFO: Waiting for application startup. 2023-04-16 16:51:21,651 - chatgpt_proxy.proxy - ERROR - 'ascii' codec can't encode character '\xdf' in position 102: ordinal not in range(128) Traceback (most recent call last): File "/Users/s/PycharmProjects/chatgpt_crack_test/chatgpt-proxy/chatgpt_proxy/proxy.py", line 169, in _refresh_task await self._refresh_puid() File "/Users/s/PycharmProjects/chatgpt_crack_test/chatgpt-proxy/chatgpt_proxy/proxy.py", line 151, in _refresh_puid resp = await client.get( ^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1754, in get return await self.request( ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1530, in request return await self.send(request, auth=auth, follow_redirects=follow_redirects) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1617, in send response = await self._send_handling_auth( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1645, in _send_handling_auth response = await self._send_handling_redirects( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1682, in _send_handling_redirects response = await self._send_single_request(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1719, in _send_single_request response = await transport.handle_async_request(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/httpx/_transports/asgi.py", line 162, in handle_async_request await self.app(scope, receive, send) File "/usr/local/lib/python3.11/site-packages/fastapi/applications.py", line 276, in call await super().call(scope, receive, send) File "/usr/local/lib/python3.11/site-packages/starlette/applications.py", line 122, in call await self.middleware_stack(scope, receive, send) File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 184, in call raise exc File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 162, in call await self.app(scope, receive, _send) File "/usr/local/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 79, in call raise exc File "/usr/local/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 68, in call await self.app(scope, receive, sender) File "/usr/local/lib/python3.11/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in call raise e File "/usr/local/lib/python3.11/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in call await self.app(scope, receive, send) File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 718, in call await route.handle(scope, receive, send) File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 276, in handle await self.app(scope, receive, send) File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 66, in app response = await func(request) ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 237, in app raw_response = await run_endpoint_function( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 163, in run_endpoint_function return await dependant.call(values) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/s/PycharmProjects/chatgpt_crack_test/chatgpt-proxy/chatgpt_proxy/proxy.py", line 64, in proxy rp_resp = await self._send_request( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/s/PycharmProjects/chatgpt_crack_test/chatgpt-proxy/chatgpt_proxy/proxy.py", line 89, in _send_request rp_req = self.client.build_request(url=url, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 358, in build_request return Request( ^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/httpx/_models.py", line 335, in init Cookies(cookies).set_cookie_header(self) File "/usr/local/lib/python3.11/site-packages/httpx/_models.py", line 1045, in set_cookie_header self.jar.add_cookie_header(urllib_request) File "/usr/local/Cellar/python@3.11/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/cookiejar.py", line 1373, in add_cookie_header request.add_unredirected_header( File "/usr/local/lib/python3.11/site-packages/httpx/_models.py", line 1191, in add_unredirected_header self.request.headers[key] = value


File "/usr/local/lib/python3.11/site-packages/httpx/_models.py", line 235, in __setitem__
set_value = value.encode(self._encoding or "utf-8")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\xdf' in position 102: ordinal not in range(128)
INFO:     Application startup complete.
INFO:     Uvicorn running on http://127.0.0.1:7800 (Press CTRL+C to quit)
18870 commented 1 year ago

你的环境变量(应该是cf_clearance?)混进了一个字符 \xdf 可能不容易看出来