1>>> import requests
2>>> r = requests.post('http://httpbin.org/post', json={"key": "value"})
3>>> r.status_code
4200
5>>> r.json()
6{'args': {},
7 'data': '{"key": "value"}',
8 'files': {},
9 'form': {},
10 'headers': {'Accept': '*/*',
11 'Accept-Encoding': 'gzip, deflate',
12 'Connection': 'close',
13 'Content-Length': '16',
14 'Content-Type': 'application/json',
15 'Host': 'httpbin.org',
16 'User-Agent': 'python-requests/2.4.3 CPython/3.4.0',
17 'X-Request-Id': 'xx-xx-xx'},
18 'json': {'key': 'value'},
19 'origin': 'x.x.x.x',
20 'url': 'http://httpbin.org/post'}
1import socket
2
3target_host = "www.google.com"
4target_port = 80
5
6# create a socket object
7client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
8
9# connect the client
10client.connect((target_host,target_port))
11
12# receive some data
13response = client.recv(4096)
14print(f'Source Code: {response}')
15http_response = repr(response)
1# first do: pip install flask
2
3from flask import Flask, request
4
5app = Flask(__name__)
6
7@app.route('/', methods=['POST'])
8def result():
9 print(request.data) # raw data
10 print(request.json) # json (if content-type of application/json is sent with the request)
11 print(request.get_json(force=True)) # json (if content-type of application/json is not sent)
12
1requests.post('https://identitytoolkit.googleapis.com/v1/accounts:signUp?key={}'.format(apikey))