I have a text as GET request format:
GET /40x.jpg HTTP/1.1\r\n\
Host: ns.pb.cachecn.net\r\n\
Connection: keep-alive\r\n\
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8\r\n\
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1636.2 Safari/537.36\r\n\
Accept-Encoding: gzip,deflate,sdch\r\n\
Accept-Language: zh-CN,zh;q=0.8\r\n\
\r\n"
we know in Python there have three module ways to create HTTP request:
urllib2/urllib
httplib/urllib
Requests
but if is it possible to create a HTTP request by import the given text?
I mean use a string = the GET request text, and use this one variable string to create the HTTP request.
not by using many steps, because it is complicated to differentiate the request header, request body.