From 2f61821f90471c54ff0c28752dc4768f806d3c08 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 30 Sep 2023 07:41:01 +0000 Subject: [PATCH 1/7] Added docker file and pushed to my docker hub --- Org_Automation/Dockerfile | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Org_Automation/Dockerfile 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"] + From 8d4c16ea82f06c97603873f953c1b6069ab29c74 Mon Sep 17 00:00:00 2001 From: abhi-061 Date: Sat, 30 Sep 2023 13:32:16 +0530 Subject: [PATCH 2/7] Install requests module before running script --- Org_Automation/Compare_list.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Org_Automation/Compare_list.py b/Org_Automation/Compare_list.py index daebc6a..c77d7f1 100644 --- a/Org_Automation/Compare_list.py +++ b/Org_Automation/Compare_list.py @@ -9,8 +9,8 @@ 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'] @@ -19,6 +19,7 @@ def file_read(): if(list2[i]==list2[j]): print("SAME") + From 057a59d90cd6416802550095ab53a34081667348 Mon Sep 17 00:00:00 2001 From: abhi-061 Date: Sat, 30 Sep 2023 13:35:49 +0530 Subject: [PATCH 3/7] Comparing two lists --- Org_Automation/Compare_list.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Org_Automation/Compare_list.py b/Org_Automation/Compare_list.py index c77d7f1..b45b425 100644 --- a/Org_Automation/Compare_list.py +++ b/Org_Automation/Compare_list.py @@ -13,7 +13,7 @@ def file_read(): 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]): From ece1047ec935f35cc51bdd31b8086ed7f6938645 Mon Sep 17 00:00:00 2001 From: abhi-061 Date: Sat, 30 Sep 2023 13:38:54 +0530 Subject: [PATCH 4/7] Install requests module before running script --- Org_Automation/Endpoint_Hit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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: From ab8733ffe2c0fe7ac6b2ad6b5244f06b09a3b95a Mon Sep 17 00:00:00 2001 From: abhi-061 Date: Sat, 30 Sep 2023 18:53:05 +0530 Subject: [PATCH 5/7] Updated the script --- Org_Automation/Endpoint_hit2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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") From 7ba67cff511022b52476c263cbb2beedb9448a27 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 30 Sep 2023 13:24:13 +0000 Subject: [PATCH 6/7] Added dockerfiles for wach script --- .../url_checker1/url_checker/Dockerfile | 15 ++++++++++++++ .../url_checker1/url_checker/Endpoint_hit2.py | 20 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 Org_Automation/url_checker1/url_checker/Dockerfile create mode 100644 Org_Automation/url_checker1/url_checker/Endpoint_hit2.py 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") From b1546124d0501ab08a5555eb5b61b03750d66bcb Mon Sep 17 00:00:00 2001 From: abhi-061 Date: Sat, 30 Sep 2023 19:41:53 +0530 Subject: [PATCH 7/7] Upated Speech script with latest cersion --- Python-Speech/SPEECH.py | 58 ++++++++++++----------------------------- 1 file changed, 17 insertions(+), 41 deletions(-) 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))