Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save iotguider/973c15dfb981bfb0aca17f729409a09d to your computer and use it in GitHub Desktop.
Save iotguider/973c15dfb981bfb0aca17f729409a09d to your computer and use it in GitHub Desktop.
Code for Making GET HTTP Requests with Python in Raspberry Pi
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