Google translator - ConnectError: [Errno 11001]

hi all, I want to read pdf document line by line and translate it to a different language. below code works sometimes for couple of pages and sometimes it doesn’t works at all. please can you let me know what changes I need to make

# Importing required modules
import PyPDF2
from googletrans import Translator
# Loop for reading all the Pages
URL_COM = 'translate.google.com'
URL_LV = 'translate.google.da'
LANG = "da"
file = open('C:/Users/ambar/OneDrive/Desktop/dummy/a1.pdf', 'rb')
reader = PyPDF2.PdfFileReader(file)
num_pages = reader.numPages
for p in range(num_pages):
    page = reader.getPage(p)
    print("Page No: ", p)
    text = page.extractText()
    translator = Translator(service_urls=[URL_COM, URL_LV])
    translation = translator.translate(text, dest=LANG)
    result_text = translation.text.replace("\n", " ").replace("W", "")
    print ( result_text)