Set Up the Project
First of all, we're going to create a virtual environment within which we'll install all the required dependencies.
Python now ships with the pre-installed venv library. So, to create a virtual environment, you can use the below command:
$ python -m venv env
To activate the virtual environment named env, use the command:
- On Windows:
env\Scripts\activate.bat
- On Linux and macOS:
source env/bin/activate
To deactivate the environment (not required at this stage):
deactivate
Now we're ready to install the dependencies. The modules and libraries we are going to use in this project are:
- requests: Requests allow you to send HTTP/1.1 requests extremely easily. The module doesn't come pre-installed with Python, so we need to install it using the command:
$ pip install requests - bs4: Beautiful Soup(bs4) is a Python library for pulling data out of HTML and XML files. The module doesn't come pre-installed with Python, so we need to install it using the command:
$ pip install bs4 - Flask: Flask is a simple, easy-to-use microframework for Python that can help build scalable and secure web applications. The module doesn't come pre-installed with Python, so we need to install it using the command:
$ pip install flask - Flask-RESTX: Flask-RESTX lets you create APIs with Swagger Documentation. The module doesn't come pre-installed with Python, so we need to install it using the command:
$ pip install flask-restx
We'll also use environment variables in this project. So, we are going to install another module called python-decouple to handle this:
pip install python-decouple
To learn more about environment variables in Python, you can check out this article.
5
