From 811d44c98123b601c32e2d3ff185b223aa3f5c5b Mon Sep 17 00:00:00 2001
From: Raghuram Subramani <raghus2247@gmail.com>
Date: Thu, 27 Mar 2025 23:25:59 +0530
Subject: [PATCH] clean

---
 scrape_ecourtindia_v6/web.py | 49 +------------------------------------------------
 1 file changed, 1 insertion(+), 48 deletions(-)

diff --git a/scrape_ecourtindia_v6/web.py b/scrape_ecourtindia_v6/web.py
index a0bf0b0..07827d0 100644
--- a/scrape_ecourtindia_v6/web.py
+++ a/scrape_ecourtindia_v6/web.py
@@ -1,72 +1,25 @@
 import os
 from flask import Flask, send_from_directory, abort
 
 app = Flask(__name__)
 
-# Directory where PDFs are stored
 PDF_DIRECTORY = './pdf'
 
 @app.route('/pdf/<filename>')
 def view_pdf(filename):
-    """
-    Route to view a PDF file from the specified directory.
-    
-    Args:
-        filename (str): Name of the PDF file to display
-    
-    Returns:
-        PDF file or 404 error if file doesn't exist
-    """
     try:
-        # Ensure the filename is safe and exists
         if not filename.endswith('.pdf'):
             abort(400, description="Invalid file type. Only PDF files are allowed.")
         
-        # Check if the file exists in the PDF directory
         filepath = os.path.join(PDF_DIRECTORY, filename)
         if not os.path.exists(filepath):
             abort(404, description="PDF file not found")
         
-        # Send the PDF file
         return send_from_directory(PDF_DIRECTORY, filename, as_attachment=False)
     
     except Exception as e:
         abort(500, description=f"Internal server error: {str(e)}")
-
-@app.route('/pdf')
-def list_pdfs():
-    """
-    Route to list all available PDF files in the directory.
-    
-    Returns:
-        HTML page with list of PDFs or error message
-    """
-    try:
-        # Get list of PDF files in the directory
-        pdf_files = [f for f in os.listdir(PDF_DIRECTORY) if f.endswith('.pdf')]
-        
-        # Create a simple HTML response with links to PDFs
-        pdf_links = "\n".join([
-            f'<li><a href="/pdf/{file}">{file}</a></li>' 
-            for file in pdf_files
-        ])
-        
-        return f"""
-        <html>
-            <head><title>PDF Viewer</title></head>
-            <body>
-                <h1>Available PDFs</h1>
-                <ul>{pdf_links}</ul>
-            </body>
-        </html>
-        """
-    
-    except Exception as e:
-        abort(500, description=f"Error listing PDFs: {str(e)}")
 
 if __name__ == '__main__':
-    # Ensure PDF directory exists
     os.makedirs(PDF_DIRECTORY, exist_ok=True)
-    
-    # Run the Flask app
-    app.run(host='0.0.0.0', port=8000, debug=True)
+    app.run(host='0.0.0.0', port=8000)
--
rgit 0.1.5