Install pip in the Raspberry Pi & using requests for HTTP request via JSON

What is pip:

pipĀ is used for downloading and managing python packages/libraries.

Install pip:

Download the from internet:

wget ""

Run the file with sudo:

sudo python

What is requests:

Requests is an elegant and simple HTTP library for Python.

Install requests:

sudo pip install requests


Create and edit a python file in Pi with


By the following code, we are able to make a simple GET request:

import requests

base_url = ''
path = '/apis/hello'

r = requests.get(base_url+path)

status_code = r.status_code

json_data = r.json()


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s