install request on linux code example

Example 1: install requests python

pip install requests # or pip3 install requests

Example 2: Python Requests kali linux

Python Requests Package
To make RESTful requests with Python you need to install the requests library manually using the Python package manager, pip. When you install pip there will be a suggestion to update it — do not update pip, the newest version is incompatible and the current version works fine. To use pip you will first need to install the appropriate package for your Python interpreter using apt-get.

For Python 2.7
First, make sure your package tool is up-to-date with your package repositories. Do NOT apt-get upgrade!

sudo apt-get update

Next, use your package tool to install pip. Do NOT upgrade pip, regardless of warnings.

sudo apt-get install python-pip

Use the Python package manager to install the requests library.

sudo pip install requests

In your Python scripts make sure you import the library once it has been installed.

import requests

For Python 3.4
First, make sure your package tool is up-to-date with your package repositories. Do NOT apt-get upgrade!

sudo apt-get update

Next, use your package tool to install pip. Do NOT upgrade pip, regardless of warnings.

sudo apt-get install python3-pip

Use the Python package manager to install the requests library.

sudo pip install requests

In your Python scripts make sure you import the library once it has been installed.

import requests

Checking pip Version and Uninstalling
To check the version of pip you have installed, and to see which version of Python it is tied to:

pip -V

To uninstall python-pip for Python 2.7, for example to move to pip for Python 3.4:

sudo apt-get remove python-pip

To uninstall python3-pip for Python 3.4, for example to move to pip for Python 2.7:

sudo apt-get remove python3-pip

Source:
http://developer.opto22.com/epicdev/python/#for-python-34