Created
May 11, 2018 07:18
-
-
Save iotguider/973c15dfb981bfb0aca17f729409a09d to your computer and use it in GitHub Desktop.
Code for Making GET 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.get('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