Link Validator tool

Arun
5 min read
Featured Image

This efficient Link Validator is written in Python using the Python modules Pandas and Requests. Using the streaming option of the requests module helps to complete the validation without fully downloading very large files.

The URLs are read from an Excel file (Links worksheet) using pandas.read_excel and the rows are processed using the pandas DataFrame.apply subroutine. The Link Validation status is written to another Excel file using pandas.ExcelWriter.

Usage

  1. Install the required modules Pandas and Requests using pip or pip3, also xlrd and openpyxl module is required for reading and writing Excel files
    pip3 install pandas
    pip3 install requests
    pip3 install xlrd
    pip3 install openpyxl
  2. Create Excel file with Links Worksheet with URLs in the URL column (e.g.: Link_Validator.xlsx)
  3. Download Link_Validator.py
  4. Edit the Link_Validator.py using notepad or any other editor and enter the path of created Excel file and output Excel file (file is created if not exists)
    # Read URLs from Excel file
    df = pandas.read_excel("D:\\Selenium\\Link_Validator.xlsx",sheet_name="Links")
    ...
    # Write status as Excel file
    with pandas.ExcelWriter("D:\\Selenium\\Link_Status.xlsx") as writer:
        df.to_excel(writer, sheet_name="Link Status", index=False)
  5. Run the Link_Validator.py using python or python3
    C:\Users\Arun>D:
    D:\>cd Selenium
    D:\Selenium>python Link_Validator.py
    Status: 200 Time: 0.6112735271453857
    Final URL: http://example.com/
    Status: 200 Time: 0.5624599456787109
    Final URL: http://example.org/

    D:\Selenium>
  6. Open the output Excel file for the Status

Link_Validator.py

Capture Screenshot add-on

Arun Arun
5 min read

Table Download add-on

Arun Arun
5 min read

Firefox add-on Session Alive

Arun Arun
10 min read