'Reading sent data from requests to Socket in python
I want to decode the data sent from requests to a server socket but i don't know what format the data is is there a way to decode this?
(the output was long its a small part of it)
b'\x16\x03\x01\x02\x00\x01\x00\x01\xfc\x03\x03,3\x90*\xfe\x8f\xc2\xc2J\xeaCUz6\x91
server
# server
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
port = 80
s.bind(('', port))
s.listen(5)
while True:
c, addr = s.accept()
data = c.recv(5048)
print ('Got connection from', addr )
c.send('Thank you for connecting'.encode())
print(data)
c.close()
requests
import requests
payload = {'key1': 'value1', 'key2': 'value2'}
r = requests.get('https://localhost:80', params=payload)
print(r)
Solution 1:[1]
On the server site you need to implement https(Hypertext-Transfer-Protokoll-Secure).
Or you use flask.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Marcel |
