标签:odi dmi 浏览器 http请求 class cep recv 1.5 wql
https://www.cnblogs.com/liwenzhou/articles/8620663.html
import socket #生成sokect实例 sk =socket.socket() #绑定ip和端口 sk.bind(("127.0.0.1",8000)) #监听 sk.listen() #写一个循环等待客户端的连接. while 1: #获取客户端的链接 conn, _ =sk.accept() #接收客户端发来的消息 data =conn.recv(8096) print(data) #给客户端回复消息 conn.send(b"hello") #关闭 conn.close() sk.close()
b‘GET / HTTP/1.1\r\n Host: 127.0.0.1:8000\r\n Connection: keep-alive\r\nUpgrade-Insecure-Requests: 1\r\n User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\r\nAccept-Encoding: gzip, deflate, br\r\n Accept-Language: zh-CN,zh;q=0.9\r\n Cookie: __guid=96992031.196438983550187420.1534755060914.9175; csrftoken=TGzlOSkvWQLgnrVlVuobDQ0KxLDHxycZ0VPimfwZyRXGBLP7L7v9Uc93hdzlewyY; sessionid=vodmiblg1pkrql3cfqv7l8zxw9fkhrj3\r\n \r\n‘
标签:odi dmi 浏览器 http请求 class cep recv 1.5 wql
原文地址:https://www.cnblogs.com/mengbin0546/p/9941657.html