Python: read http data | Sololearn: Learn to code for FREE!

+2

Python: read http data

i writing a server in python. and when access it, i got this data: (access using: 127.0.0.1) b'GET / HTTP/1.1\r\nHost: 127.0.0.1\r\nUser-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Language: en-US,en;q=0.5\r\nAccept-Encoding: gzip, deflate\r\nConnection: keep-alive\r\nUpgrade-Insecure-Requests: 1\r\n\r\n' is there a module that can read all those datas? so it can be simple as in php.

3/21/2018 10:34:38 AM

Kevin AS

2 Answers

New Answer

+4

I would suggest using the socket module. It is already installed once you install python on your pc. If you need help on the socket module, go watch sentdex’s tutorials on the socket module

+3

unfortunately, that i use socket