PyBaiduYuyin icon indicating copy to clipboard operation
PyBaiduYuyin copied to clipboard

TypeError: POST data should be bytes or an iterable of bytes. It cannot be of type str.

Open alatriste-lee opened this issue 7 years ago • 1 comments

response = urlopen("https://openapi.baidu.com/oauth/2.0/token", data=urlencode(data))

alatriste-lee avatar Sep 22 '16 04:09 alatriste-lee

response = urlopen("https://openapi.baidu.com/oauth/2.0/token", data=urlencode(data).encode('utf-8'))

你肯定是在用python3 改为urlencode(data).encode('utf-8') 就行了。

makelove avatar Nov 11 '16 09:11 makelove