Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save iotguider/de458bbb2f3d612acf85d78f5e0b608d to your computer and use it in GitHub Desktop.
Save iotguider/de458bbb2f3d612acf85d78f5e0b608d to your computer and use it in GitHub Desktop.
Code for Making POST HTTP Requests with Python in Raspberry Pi
import requests
import json
url="http://example.com/index.php"
r = requests.post('http://example.com/index.php', params={'q': 'raspberry pi request'})
if r.status_code != 200:
print "Error:", r.status_code
data = r.json()
example = data["value1"]["value2"]
print(example)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment