From 306fa330e5576cfd8190f5e831f950bb8593f8bb Mon Sep 17 00:00:00 2001
From: prashantsuk <42904978+prashantsuk@users.noreply.github.com>
Date: Tue, 11 Feb 2025 10:28:34 +0000
Subject: [PATCH 1/7] update file

---
 Day-12/prashant_server.py | 12 ++++++++++++
 Day-12/server.conf        | 17 -----------------
 2 files changed, 12 insertions(+), 17 deletions(-)
 create mode 100644 Day-12/prashant_server.py

diff --git a/Day-12/prashant_server.py b/Day-12/prashant_server.py
new file mode 100644
index 00000000..7cd5109c
--- /dev/null
+++ b/Day-12/prashant_server.py
@@ -0,0 +1,12 @@
+def update_server_config(file_path, key, value):
+    with open(file_path, "r") as file:
+        lines = file.readlines()
+    with open(file_path,"w") as file:
+        for line in lines:
+            if key in lines:
+                file.write(key + "=" + value + "\n")
+            else:
+                file.write(lines)
+update_server_config("server.conf" , "MAX_CONNECTIONS" ,"100")                    
+
+                
\ No newline at end of file
diff --git a/Day-12/server.conf b/Day-12/server.conf
index e9d46d83..e69de29b 100644
--- a/Day-12/server.conf
+++ b/Day-12/server.conf
@@ -1,17 +0,0 @@
-# Server Configuration File
-
-# Network Settings
-PORT = 8080
-MAX_CONNECTIONS=600
-TIMEOUT = 30
-
-# Security Settings
-SSL_ENABLED = true
-SSL_CERT = /path/to/certificate.pem
-
-# Logging Settings
-LOG_LEVEL = INFO
-LOG_FILE = /var/log/server.log
-
-# Other Settings
-ENABLE_FEATURE_X = true
\ No newline at end of file

From f132a4c25ea7480248696285ff67f9c95c41bebe Mon Sep 17 00:00:00 2001
From: prashantsuk <42904978+prashantsuk@users.noreply.github.com>
Date: Tue, 11 Feb 2025 16:06:20 +0530
Subject: [PATCH 2/7] Update server.conf

---
 Day-12/server.conf | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/Day-12/server.conf b/Day-12/server.conf
index e69de29b..2e0f9819 100644
--- a/Day-12/server.conf
+++ b/Day-12/server.conf
@@ -0,0 +1,17 @@
+# Server Configuration File
+
+# Network Settings
+PORT = 8080
+MAX_CONNECTIONS=600
+TIMEOUT = 30
+
+# Security Settings
+SSL_ENABLED = true
+SSL_CERT = /path/to/certificate.pem
+
+# Logging Settings
+LOG_LEVEL = INFO
+LOG_FILE = /var/log/server.log
+
+# Other Settings
+ENABLE_FEATURE_X = true

From 66148cd9e31cd2459c3af732952df532faf14b3e Mon Sep 17 00:00:00 2001
From: prashantsuk <42904978+prashantsuk@users.noreply.github.com>
Date: Tue, 11 Feb 2025 16:14:50 +0530
Subject: [PATCH 3/7] Update prashant_server.py

---
 Day-12/prashant_server.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/Day-12/prashant_server.py b/Day-12/prashant_server.py
index 7cd5109c..a2446003 100644
--- a/Day-12/prashant_server.py
+++ b/Day-12/prashant_server.py
@@ -1,12 +1,14 @@
 def update_server_config(file_path, key, value):
     with open(file_path, "r") as file:
         lines = file.readlines()
+
+
     with open(file_path,"w") as file:
         for line in lines:
-            if key in lines:
+            if key in line:
                 file.write(key + "=" + value + "\n")
             else:
-                file.write(lines)
-update_server_config("server.conf" , "MAX_CONNECTIONS" ,"100")                    
+                file.write(line)
+update_server_config("server.conf" , "PORT" ,"8080")                    
 
-                
\ No newline at end of file
+                

From d45e03aabf73bdb5babd19543a168c3aedc04b15 Mon Sep 17 00:00:00 2001
From: prashantsuk <42904978+prashantsuk@users.noreply.github.com>
Date: Wed, 12 Feb 2025 19:09:00 +0530
Subject: [PATCH 4/7] Create main.yml

---
 .github/workflow/main.yml | 64 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 64 insertions(+)
 create mode 100644 .github/workflow/main.yml

diff --git a/.github/workflow/main.yml b/.github/workflow/main.yml
new file mode 100644
index 00000000..d77c6a70
--- /dev/null
+++ b/.github/workflow/main.yml
@@ -0,0 +1,64 @@
+name: Fetch JIRA Projects
+
+on:
+  push:
+    branches:
+      - main  # Runs on every push to the main branch
+  workflow_dispatch:  # Allows manual execution
+
+jobs:
+  fetch-jira:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout Repository
+        uses: actions/checkout@v3
+
+      - name: Set Up Python
+        uses: actions/setup-python@v4
+        with:
+          python-version: '3.9'
+
+      - name: Install Dependencies
+        run: pip install requests
+
+      - name: Fetch JIRA Projects
+        env:
+          JIRA_TOKEN: ${{ secrets.JIRA_TOKEN }}
+        run: |
+          python - <<EOF
+          import requests
+          from requests.auth import HTTPBasicAuth
+          import json
+          import os
+
+          # JIRA API Credentials
+          email = "prashantsukhadeve123@gmail.com"
+          api_token = os.getenv("JIRA_TOKEN")
+
+          if not api_token:
+              raise ValueError("JIRA_TOKEN environment variable is missing!")
+
+          url = "https://prashantsukhadeve123.atlassian.net/rest/api/3/project"
+          auth = HTTPBasicAuth(email, api_token)
+
+          headers = {
+              "Accept": "application/json"
+          }
+
+          response = requests.request(
+              "GET",
+              url,
+              headers=headers,
+              auth=auth
+          )
+
+          output = json.loads(response.text)
+
+          if response.status_code == 200:
+              name = output[1]["name"]
+              print(f"Project Name: {name}")
+              print(json.dumps(output, sort_keys=True, indent=4, separators=(',', ': ')))
+          else:
+              print(f"Error {response.status_code}: {response.text}")
+
+          EOF

From 68b92361cfa390cbfed10863230e220c1f326621 Mon Sep 17 00:00:00 2001
From: prashantsuk <42904978+prashantsuk@users.noreply.github.com>
Date: Wed, 12 Feb 2025 19:11:27 +0530
Subject: [PATCH 5/7] Create jira.py

---
 Day-14/jira.py | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 Day-14/jira.py

diff --git a/Day-14/jira.py b/Day-14/jira.py
new file mode 100644
index 00000000..65ad4085
--- /dev/null
+++ b/Day-14/jira.py
@@ -0,0 +1,26 @@
+# This code sample uses the 'requests' library:
+# http://docs.python-requests.org
+import requests
+from requests.auth import HTTPBasicAuth
+import json
+
+url = "https://prashantsukhadeve123.atlassian.net/rest/api/3/project"
+
+auth = HTTPBasicAuth("prashantsukhadeve123@gmail.com", "JIRA_TOKEN")
+
+headers = {
+  "Accept": "application/json"
+}
+
+response = requests.request(
+   "GET",
+   url,
+   headers=headers,
+   auth=auth
+)
+output = json.loads(response.text)
+name = output[1]["name"]
+print (name)
+
+print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": ")))
+

From 1071597891a22043e0a28538e9b0bb3dc4b84f8c Mon Sep 17 00:00:00 2001
From: prashantsuk <42904978+prashantsuk@users.noreply.github.com>
Date: Wed, 12 Feb 2025 19:13:02 +0530
Subject: [PATCH 6/7] Update README.md

---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 0dc09cb5..6213c2cb 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# Python Zero to Hero for DevOps Engineers
+# Python Zero to Hero for DevOps Engineers.......
 
 <img width="1141" alt="Screenshot 2023-10-12 at 9 57 40 PM" src="https://github.com/iam-veeramalla/python-for-devops/assets/43399466/d70f5fe2-0ba3-449d-b41f-413a38fc4584">
 

From 9a62be70bd305a63677e665cfc5b27b769e6bf30 Mon Sep 17 00:00:00 2001
From: prashantsuk <42904978+prashantsuk@users.noreply.github.com>
Date: Thu, 13 Feb 2025 15:44:18 +0530
Subject: [PATCH 7/7] Create prashant-Jiraticket-automation.py

---
 Day-15/prashant-Jiraticket-automation.py | 67 ++++++++++++++++++++++++
 1 file changed, 67 insertions(+)
 create mode 100644 Day-15/prashant-Jiraticket-automation.py

diff --git a/Day-15/prashant-Jiraticket-automation.py b/Day-15/prashant-Jiraticket-automation.py
new file mode 100644
index 00000000..a1692240
--- /dev/null
+++ b/Day-15/prashant-Jiraticket-automation.py
@@ -0,0 +1,67 @@
+# This code sample uses the 'requests' library:
+# http://docs.python-requests.org
+import requests
+from requests.auth import HTTPBasicAuth
+import json
+from flask import Flask
+
+app = Flask(__name__)
+
+# Define a route that handles GET requests
+@app.route('/createJira', methods=['POST'])
+def createJira():
+
+    
+    url = "https://prashantsukhadeve123.atlassian.net/rest/api/3/project"
+
+    
+
+   
+    auth = HTTPBasicAuth("prashantsukhadeve123@gmail.com", "<Please add jira account token here")
+
+    headers = {
+        "Accept": "application/json",
+        "Content-Type": "application/json"
+    }
+
+    payload = json.dumps( {
+        "fields": {
+        "description": {
+            "content": [
+                {
+                    "content": [
+                        {
+                            "text": "Order entry fails when selecting supplier.",
+                            "type": "text"
+                        }
+                    ],
+                    "type": "paragraph"
+                    }
+                ],
+            "type": "doc",
+             "version": 1
+        },
+        "project": {
+           "key": "SCRUM"
+        },
+        "issuetype": {
+            "id": "10003"
+        },
+        "summary": "Main order flow broken",
+    },
+    "update": {}
+    } )
+
+
+    response = requests.request(
+        "POST",
+        url,
+        data=payload,
+        headers=headers,
+        auth=auth
+    )
+
+    return json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": "))
+
+if __name__ == '__main__':
+    app.run(host='0.0.0.0', port=5000)