From 76ef4f2d24ac03e8dec7120c9e588a5e70e7c925 Mon Sep 17 00:00:00 2001
From: ANTO SAGAYA JUSTIN R
 <7411-justinmass2001@users.noreply.git.selfmade.ninja>
Date: Thu, 2 May 2024 09:59:08 +0000
Subject: [PATCH] Initial Commit

---
 create venv file/create venv file.txt | 11 ++++-
 flask/app.py                          | 61 ++++++++++++++++++++++-----
 2 files changed, 60 insertions(+), 12 deletions(-)

diff --git a/create venv file/create venv file.txt b/create venv file/create venv file.txt
index 5582cd3..fea99d0 100644
--- a/create venv file/create venv file.txt	
+++ b/create venv file/create venv file.txt	
@@ -5,4 +5,13 @@ Activate This Venv File:
     source iotcloud/bin/activate
 
 Linex System PC Full Information Command:
-    /proc/cpuinfo
\ No newline at end of file
+    /proc/cpuinfo
+
+python strip function:
+    1. your code or any input valu for example cpuinfo and whoami any tab space to your code error.
+    2. use strip to illuminate the extra spaces.
+
+Flask redirect package:
+    This is a basic illustration of redirection in Flask. 
+    You can redirect to any route within your Flask application using the redirect() function.
+    combined with url_for() to specify the route's endpoint.
\ No newline at end of file
diff --git a/flask/app.py b/flask/app.py
index fc3e740..a53a72a 100644
--- a/flask/app.py
+++ b/flask/app.py
@@ -1,11 +1,13 @@
 from flask import Flask
 app = Flask(__name__)
 import os
-Basename = '/iotcloud'
-# app.debug = True ( for any debug error to True that line ) 
+import math
+basename = '/iotcloud'
 
-
-# @app.route na searching route ex:[172.30.0.231:7000/hello] to view your flask project.
+# app.debug = True ( for any debug error for True that line ) 
+      
+# @app.route 
+      # 1.To Searching route ex:[172.30.0.231:7000/hello] to view your flask project.
 @app.route('/hello')
 def hello_world():
    return "<h1>Hello World 123<h1/>"
@@ -17,15 +19,52 @@ def hello():
 @app.route('/whoami')
 def whoami():
    return "<h1>"+os.popen('whoami').read()+"<h1/>"
-   # Which one you can return for this command [this is this system user name]
 
+# whoami:
+   # Lhis Linux Command To Return This System Username For Example [ justinmass2001 ].
+
+@app.route(basename+'/cpuinfo')
 def cpuinfo():
-   return "<pre>" "<h3>"+ os.popen('cat /proc/cpuinfo').read() +"<pre/>" "<h3/>"
-   # return = Which one you can return for this command [this is system full information]
-   # <pre> = To HTML tag Which Terminal output You Can Inset to Same output and display
-app.add_url_rule (Basename+'/whoami','whoami',whoami)
-app.add_url_rule (Basename+'/cpuinfo','cpuinfo',cpuinfo)
+    return "<pre>" "<h3>"+ os.popen('cat /proc/cpuinfo').read() +"<pre/>" "<h3/>"
+'''
+       <pre> and cat /proc/cpuinfo:
+            1. <pre> = This HTML Tag Which Terminal output You Can Inset to Same output to display
+                Not Using <pre> output result:
+                     processor : 1 vendor_id : GenuineIntel cpu family : 6 model : 183
+
+                Example Result using <pre> output:
+                     processor	 : 1
+                     vendor_id	 : GenuineIntel
+                     cpu family : 6
+                     model		 : 183
+            2. cat /proc/cpuinfo = This is Linux Command For CPU Full Informations.
+'''
+@app.route(basename+'/echo', methods = ['GET','POST'])
+def echo_help():
+   return '<h1>'+"Please use as /echo/some string"+'</h1>'
+
+@app.route(basename+'/echo/<string>')     
+      # echo:
+         # echo = your any input type to same return output this echo 
+            # Example:[172.30.0.231:7000/iotcloud/echo/justin] output result justin.
+
+def echo(string):
+   return "You said: {}".format(string) 
+# app.add_url_rule (Basename+'/whoami','whoami',whoami)
+# app.add_url_rule (Basename+'/cpuinfo','cpuinfo',cpuinfo)
+
+@app.route(basename+'/pow/<int:a>/<int:b>')
+def power ( a , b ):
+   try:
+      return "pow of {}, {}: {}".format ( a , b ,math.pow( a , b ))
+   except:
+      return "This is too much"
+# <int:a> /<int:b>:
+         # int = integer value.
+         # search browser 172.30.0.231:7000/iotcloud/pow/(integer valu)10/30.
+         # try = error handling any error to return except command. 
 
 if __name__ == '__main__':
    app.run(host = '0.0.0.0' , port = '7000' , debug = True )
-   # your access all type of IP address to add [host = '0.0.0.0'] Running on all IP addresses
\ No newline at end of file
+      # host = '0.0.0.0': 
+            # your access all type of IP address to add [host = '0.0.0.0'] Running on all IP addresses
\ No newline at end of file
-- 
GitLab