因“UnicodeEncodeError: ‘latin-1‘ codec can‘t encode characters in position 17-19...”迁出的编码和解码
...中间部分省略哈...
运行报错
原因是请求body里面有 汉字,没有进行untf-8编码导致,解决方法,对data进行 encode()编码
response = requests.request("POST", self.url, data=self.payload.encode(), headers=self.headers)
ok!wait a minite!突然联想到了编码与解码之前微妙的关系,看了下专门研究过的大佬的笔记,make下
python内部使用的是unicode编码,.
原创
2021-01-23 16:45:30 ·
1328 阅读 ·
0 评论