0

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

Community
  • 1
  • 1
user6575792
  • 69
  • 1
  • 7
  • Presumably it's the body you're going to send with the HTTP request. – user94559 Jul 17 '16 at 06:21
  • @smarx I am utterly unable to understand. body to HTTP? Kindly elaborate. I am a newbie. – user6575792 Jul 17 '16 at 06:26
  • @smarx In this line we are not sending any body to HTTP . req = urllib.request.Request(Link, headers={'User-Agent': 'Chrome/51.0.2704.103'}) – user6575792 Jul 17 '16 at 06:28
  • If you're not sending any body, then you don't need a `Content-Length` header. Maybe you can ask a different question that relates to what you're actually trying to do. – user94559 Jul 17 '16 at 06:32

0 Answers0