Python到php服务器获取数据

Ok I'm a little confused here I need to send data to a php server and receive back a response from it example: a raspberry pi sends a unit id and the server returns json file.

I have tried this .py code

import requests
import json

url = 'http://localhost/updateContent.php'
payload = {"device":"gabriel","data_type":"data","zone":1,"sample":4,"count":0,"time_stamp":"00:00"}
headers = {'content-type': 'application/json'}

response = requests.post(url, data=json.dumps(payload), headers=headers)

but obviously this post the data but I don't get a response from the php server

What kind of protocal should I use for this?

response = requests.post(url, data=json.dumps(payload), headers=headers)

To output the result of your post you have to print out response.text print(response.text);