Created
May 14, 2018 17:16
-
-
Save iotguider/de458bbb2f3d612acf85d78f5e0b608d to your computer and use it in GitHub Desktop.
Code for Making POST HTTP Requests with Python in Raspberry Pi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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