Set the header in urllib.request python 3

2019-09-10 04:46发布

问题:

What is the meaning of body (refers to?) in the code below?

headers = ['Content-length']=str(len(bytes(body, 'utf-8')))

return urllib.request.Request(theurl, bytes(body, 'utf-8'), headers)

Sourse : BadStatusLine exception raised when returning reply from server in Python 3