Max retries exceeded....Failed to establish a new connection: [Error 111] 'Connection refused'

I am trying to upload a description to the localhost via method. But the error keeps coming for max retries. How can I reduce that and, is there any way around to get past this?

Here's my code:

#!/usr/bin/env python3
import os
import time
import requests

URL = ""
description_files = os.listdir("supplier- 
image_names = [img for img in 
os.listdir("supplier-data/images/") if img[-4: ] == 'jpeg']
image_index = 0

for file in description_files:
    description = {}

    with open("supplier-data/descriptions/" + file, 'r') as des_file:
        lines = des_file.readlines()
        description['name'] = lines[0]
        description['weight'] = int(lines[1][:-4])
        description['description'] = lines[2]
        description['image_name'] = image_names[image_index]
        image_index += 1

    response =, data = description)