天灵狐的小岛

摔倒说明我还绰绰有余啊!

Postman生成Python3编码执行报错的修复方案

报错:

Traceback (most recent call last):
  File "C:\Users\Tian\Desktop\test2.py", line 13, in <module>
    conn.request("POST", "/login", payload, headers)
  File "C:\Users\Tian\AppData\Local\Programs\Python\Python35\lib\http\client.py", line 1083, in request
    self._send_request(method, url, body, headers)
  File "C:\Users\Tian\AppData\Local\Programs\Python\Python35\lib\http\client.py", line 1127, in _send_request
    body = body.encode('iso-8859-1')
UnicodeEncodeError: 'latin-1' codec can't encode characters in position 499-500: ordinal not in range(256)


解决方案:

在payload下方加上一句

payload = payload.encode('utf-8') 

即可。
阅读更多
个人分类: Python
想对作者说点什么? 我来说一句

使用POSTMAN软件生成cURL请求

t1g2q3 t1g2q3

2018-02-28 07:50:15

阅读数:629

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭