In this tutorial we are going to download and install urllib3 in Python or in Anaconda Python. After installing we will also learn to make example program using urllib3 package of Python.In this tutorial we are going to download and install urllib3 in Python or in Anaconda Python. After installing we will also learn to make example program using urllib3 package of Python.
In this tutorial we are going to download the urllib3 package of python and then install it on the Python 3 environment. We will also show you how you can install the urllib3 package on the Anaconda distribution of Python. The urllib3 is one of the most used library in Python which is used for working with the server through http protocol. You also learn to make simple program using the urllib3 library in Python 3.
This library is one of the most used library in Python for accessing the URL and performing various types of interaction with the HTTP server from Python program. In this tutorial we will learn urllib3 library in detail. We will also show you many examples of urllib3.
The urllib3 is Python library for working the the HTTP server and handling various types of HTTP requests in python program. The urllib3 is simply a module in Python for handling ht URL in Python program. For example you can access an HTTP URL on Internet and download the data from that URL. This makes development of Python program which calls the URL in much easier way. You can use the urlopen() function of this library to fetch the data from an URL in Python program.
The urllib3 is powerful Python library for interacting with the HTTP server. Here are the features of the urllib3 library:
The urllib3 is an easy to use library which can be used in python program just importing the urllib3 package.
The urllib3 library comes with many modules which makes the HTTP programming easy for Python developers. Here are the features of urllib3 library:
All these modules of the library allows the developers to write Python program that interacts with the HTTP server.
The pip installer can be easily used to install the urllib3 library in your Python environment. Here is the command to install ulllib3:
pip install urllib3
The pip utility will download the urllib3 required files and then run the installation. Above command will install urllib3 module on your Python environment.
The urllib3 is powerful module in Python which is used to get data, post data, stream data, interact with HTTP server with HTTP command and use redirects. This library can also be used to work with JSON request and responses.
Check the version of urlib3 installed on the machine. First of all we will check the version of urllib3 library installed in the Python environment, for this open the Python terminal and then run following program:
import urllib3 print(urllib3.__version__)
Here is the output of program:
[email protected]:~$ python Python 3.7.0 (default, Jun 28 2018, 13:15:42) [GCC 7.2.0] :: Anaconda, Inc. on linux Type "help", "copyright", "credits" or "license" for more information. >>> import urllib3 >>> print(urllib3.__version__) 1.23
Above code shows the version of urllib3 module installed on my machine and it is 1.23. Now it is confirmed that urllib3 is correctly installed on my computer and it can be used for programming. Here is the screenshot of the program tested on Ubuntu 18.04 system:
Here is simple example to get the data from HTTP server using GET HTTP method. Following example code reads the data from website and then prints the html code returned from the server:
import urllib.request request = urllib.request.urlopen('https://www.python.org/') print(request.read())
Above code reads the data from python.org website and then prints the data. Here is the screen shot:
Check more tutorials at: