TheSlientnight / douyu_helper

自动赠送荧光棒
40 stars 62 forks source link

正常复制的cookie报 UnicodeEncodeError #9

Closed LunaticTian closed 3 years ago

LunaticTian commented 3 years ago

cookie 是按说明正常复制的,但是依旧报错。

2021-10-10 16:27:33 - 【INFO】: ------登录检查开始------ Traceback (most recent call last): File "main.py", line 60, in run() File "main.py", line 14, in run login_res = is_login() File "/home/runner/work/douyu_helper/douyu_helper/common/login_check.py", line 14, in is_login login = dyreq.request("get", login_url).json() File "/home/runner/work/douyu_helper/douyu_helper/common/douyu_request.py", line 23, in request return self.session.request(method, url=url, headers=self.header, kwargs) File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/requests/sessions.py", line 542, in request resp = self.send(prep, send_kwargs) File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/requests/sessions.py", line 655, in send r = adapter.send(request, kwargs) File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/requests/adapters.py", line 449, in send timeout=timeout File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/urllib3/connectionpool.py", line 706, in urlopen chunked=chunked, File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/urllib3/connectionpool.py", line 394, in _make_request conn.request(method, url, httplib_request_kw) File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/urllib3/connection.py", line 239, in request super(HTTPConnection, self).request(method, url, body=body, headers=headers) File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/http/client.py", line 1281, in request self._send_request(method, url, body, headers, encode_chunked) File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/http/client.py", line 1322, in _send_request self.putheader(hdr, value) File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/urllib3/connection.py", line 224, in putheader _HTTPConnection.putheader(self, header, *values) File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/http/client.py", line 1254, in putheader values[i] = one_value.encode('latin-1') UnicodeEncodeError: 'latin-1' codec can't encode characters in position 675-678: ordinal not in range(256) Error: Process completed with exit code 1.

TheSlientnight commented 3 years ago

这边没有复现你这个问题,直接复制整个cookie是正常的,注意不要把【cookie:】这段也复制到了再试试

TheSlientnight commented 3 years ago

代码有更新,请重新pull request一次之后再尝试

LunaticTian commented 3 years ago

重新拉取代码进行Actions依旧出现,使用的是chrome或者同样是chromium内核的edge同样有该问题获取。因为我也写过该项目相关的代码,但是直接复制是没有问题的....

dameng324 commented 3 years ago

@LunaticTian 我也遇到了这个问题,发现是cookie中包含中文字符导致的,如果你的斗鱼昵称是中文,那么就会出现这个问题,可以手动修改cookie中的中文改成英文的,不影响解析cookie,亲测可行。

LunaticTian commented 3 years ago

@LunaticTian我遇到了这个问题,是发现中包含中文字符导致cookie的名字,如果你的斗鱼也修改了昵称是中文,那么就会出现这个问题,可以手动cookie中的改成英文的,不影响解析cookie,亲测原来。

acf_nickname中应用名可能为中文,更改为英文成功! 感谢!