+ 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.

21st Mar 2018, 10:34 AM
Kevin AS
Kevin AS - avatar
2 ответов
+ 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
24th Mar 2018, 1:07 PM
Julian
Julian - avatar
+ 3
unfortunately, that i use socket
25th Mar 2018, 12:55 AM
Kevin AS
Kevin AS - avatar