diff --git a/Org_Automation/Compare_list.py b/Org_Automation/Compare_list.py index daebc6a..b45b425 100644 --- a/Org_Automation/Compare_list.py +++ b/Org_Automation/Compare_list.py @@ -9,16 +9,17 @@ def file_read(): for i in list: k=i.split("_") list2.append(k[0]) - #v1 / v300 - #print(list2) + v1 / v300 + print(list2) else: print("list is empty") -list2=['V1', 'V2', 'V300', 'V300', 'V301','V301'] +list2=['V1', 'V2', 'V300', 'V300', 'V301','V3021'] for i in range(len(list2)): for j in range(i+1,len(list2)): if(list2[i]==list2[j]): print("SAME") + diff --git a/Org_Automation/Dockerfile b/Org_Automation/Dockerfile new file mode 100644 index 0000000..53fa8c7 --- /dev/null +++ b/Org_Automation/Dockerfile @@ -0,0 +1,15 @@ +# Use an official Python runtime as a parent image +FROM python:3.8 + +# Set the working directory in the container +WORKDIR /app + +# Copy the current directory contents into the container at /app +COPY . /app + +# Install any needed packages specified in requirements.txt +#RUN pip install -r requirements.txt + +# Define the command to run your script when the container starts +CMD ["python", "Compare_list.py"] + diff --git a/Org_Automation/Endpoint_Hit.py b/Org_Automation/Endpoint_Hit.py index 27feebe..82212f5 100644 --- a/Org_Automation/Endpoint_Hit.py +++ b/Org_Automation/Endpoint_Hit.py @@ -16,7 +16,7 @@ def hit_endpoint(url): data2 = requests.get(link['Link'],timeout=10) if (data2.status_code==200): list.append(link['Link']) - print(list) + print('The output', list) else: print("Status Code is not 200") except requests.exceptions.Timeout: diff --git a/Org_Automation/Endpoint_hit2.py b/Org_Automation/Endpoint_hit2.py index 7b8b1cc..b2a8c89 100644 --- a/Org_Automation/Endpoint_hit2.py +++ b/Org_Automation/Endpoint_hit2.py @@ -15,6 +15,6 @@ def space_data(url): print("Total number of persons in ISS" + str(len(person_ISS))) - print("Total number of persons in ISS" + str(len(person_Tiangong))) + print("Total number of persons in Tiangong" + str(len(person_Tiangong))) space_data("http://api.open-notify.org/astros.json") diff --git a/Org_Automation/url_checker1/url_checker/Dockerfile b/Org_Automation/url_checker1/url_checker/Dockerfile new file mode 100644 index 0000000..647da54 --- /dev/null +++ b/Org_Automation/url_checker1/url_checker/Dockerfile @@ -0,0 +1,15 @@ +# Use an official Python runtime as a parent image +FROM python:3.8 + +# Set the working directory in the container +WORKDIR /app + +# Copy the current directory contents into the container at /app +COPY . /app + +# Install any needed packages specified in requirements.txt +#RUN pip install -r requirements.txt + +# Define the command to run your script when the container starts +CMD ["python", "Endpoint_Hit.py"] + diff --git a/Org_Automation/url_checker1/url_checker/Endpoint_hit2.py b/Org_Automation/url_checker1/url_checker/Endpoint_hit2.py new file mode 100644 index 0000000..7b8b1cc --- /dev/null +++ b/Org_Automation/url_checker1/url_checker/Endpoint_hit2.py @@ -0,0 +1,20 @@ +import json +import requests +person_ISS=[] +person_Tiangong=[] +def space_data(url): + data = requests.get(url) + # print(data.json()) + dump = data.json() + for person in dump["people"]: + print(person["craft"]) + if (person["craft"] == "ISS"): + person_ISS.append(person["name"]) + else: + person_Tiangong.append(person["name"]) + + + print("Total number of persons in ISS" + str(len(person_ISS))) + print("Total number of persons in ISS" + str(len(person_Tiangong))) + +space_data("http://api.open-notify.org/astros.json") diff --git a/Python-Speech/SPEECH.py b/Python-Speech/SPEECH.py index 99d817e..3c6300f 100644 --- a/Python-Speech/SPEECH.py +++ b/Python-Speech/SPEECH.py @@ -1,49 +1,25 @@ -#yPDF2 is a free and open-source pure-python -# pip install PyPDF2 -# PDF library capable of splitting, merging, cropping, and transforming the pages of PDF files - - -#pyttsx3 is a text-to-speech conversion library in Python - - -#pip install pyttsx3 - - import PyPDF2 - import pyttsx3 -pdfReader = PyPDF2.PdfFileReader(open('dummypdf.pdf', 'rb')) +try: + pdfReader = PyPDF2.PdfReader(open('dummypdf.pdf', 'rb')) -#######CASE 1 PDF READ -# Initialize the Pyttsx3 engine + # Initialize the Pyttsx3 engine + speaker = pyttsx3.init() -speaker = pyttsx3.init() + # Initialize the 'text' variable to accumulate text from all pages + text = "" -for page_num in range(pdfReader.numPages): - text = pdfReader.getPage(page_num).extractText() - speaker.say(text) - speaker.runAndWait() -speaker.stop() - - - -speaker.save_to_file(text, 'audio.mp3') - - - -####CASE 2 READ A STRING ########### -# Create a string -string = "Lorem Ipsum is simply dummy text " \ - + "of the printing and typesetting industry." - -# Initialize the Pyttsx3 engine -engine = pyttsx3.init() - -# We can use file extension as mp3 and wav, both will work -engine.save_to_file(string, 'speech.mp3') - -# Wait until above command is not finished. -engine.runAndWait() + for page_num in range(len(pdfReader.pages)): + page = pdfReader.pages[page_num] + text += page.extract_text() + speaker.say(page.extract_text()) + speaker.runAndWait() + speaker.stop() + # Save the accumulated text to an audio file + speaker.save_to_file(text, 'audio.mp3') + speaker.runAndWait() +except Exception as e: + print("An error occurred:", str(e))