From 08053f2e8446bd6bf1e9f1a6a87c811a321c4a34 Mon Sep 17 00:00:00 2001 From: Omkar1221 <67649925+Omkar1221@users.noreply.github.com> Date: Fri, 30 Aug 2024 15:38:37 +0000 Subject: [PATCH] Main added some server operations --- Day-11/04-demo-github-integration.py | 2 +- Day-11/04-practicals.py | 10 ++++++++++ Day-11/dict.py | 24 ++++++++++++++++++++++++ Day-12/server.conf | 2 +- Day-12/update_server.py | 2 +- 5 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 Day-11/dict.py diff --git a/Day-11/04-demo-github-integration.py b/Day-11/04-demo-github-integration.py index d6c96ff9..16e539a8 100644 --- a/Day-11/04-demo-github-integration.py +++ b/Day-11/04-demo-github-integration.py @@ -1,5 +1,5 @@ # Program to demonstrate integration with GitHub to fetch the -# details of Users who created Pull requests(Active) on Kubernetes Github repo. +# details of Users who created Pull requests(Active) on Kubernetes Github repo import requests diff --git a/Day-11/04-practicals.py b/Day-11/04-practicals.py index 9d0aeb9e..3de4f43d 100644 --- a/Day-11/04-practicals.py +++ b/Day-11/04-practicals.py @@ -10,6 +10,16 @@ def get_server_status(server_name): return server_config.get(server_name, {}).get('status', 'Server not found') # Example usage + server_name = 'server2' status = get_server_status(server_name) print(f"{server_name} status: {status}") + + +server_name = 'server4' +status = get_server_status(server_name) +print(f"{server_name} status: {status}") + +server_name = 'server1' +status = get_server_status(server_name) +print(f"{server_name} status: {status}") diff --git a/Day-11/dict.py b/Day-11/dict.py new file mode 100644 index 00000000..2d6856fa --- /dev/null +++ b/Day-11/dict.py @@ -0,0 +1,24 @@ + +my_dict = {'name': 'John', 'age': 25, 'city': 'New York'} + + +print(my_dict['name']) # Output: John + + + +my_dict['age'] = 26 # Modifying a value +my_dict['occupation'] = 'Engineer' # Adding a new key-value pair + + + +del my_dict['city'] # Removing a key-value pair + + + +if 'age' in my_dict: + print('Age is present in the dictionary') + + + +for key, value in my_dict.items(): + print(key, value) diff --git a/Day-12/server.conf b/Day-12/server.conf index e9d46d83..be193449 100644 --- a/Day-12/server.conf +++ b/Day-12/server.conf @@ -2,7 +2,7 @@ # Network Settings PORT = 8080 -MAX_CONNECTIONS=600 +MAX_CONNECTIONS=1000 TIMEOUT = 30 # Security Settings diff --git a/Day-12/update_server.py b/Day-12/update_server.py index 65677891..1c55b9bc 100644 --- a/Day-12/update_server.py +++ b/Day-12/update_server.py @@ -19,7 +19,7 @@ def update_server_config(file_path, key, value): # Key and new value for updating the server configuration key_to_update = 'MAX_CONNECTIONS' -new_value = '600' # New maximum connections allowed +new_value = '1000' # New maximum connections allowed # Update the server configuration file update_server_config(server_config_file, key_to_update, new_value)