Ramesh-vani commited on
Commit
403f8d1
·
verified ·
1 Parent(s): 3fed169

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -0
app.py CHANGED
@@ -487,6 +487,7 @@ async def handle_user_input(websocket,key, process, connected,process_ids):
487
  url = event["url"]
488
  body = event.get("data", "")
489
  headers = event.get("headers", {})
 
490
 
491
  if method.upper() == "GET":
492
  response = requests.get(url, headers=headers)
@@ -496,6 +497,9 @@ async def handle_user_input(websocket,key, process, connected,process_ids):
496
  response = {"error": "Unsupported method"}
497
  # Parse HTML content
498
  soup = BeautifulSoup(response.text, "html.parser")
 
 
 
499
  # Function to join relative URLs with base URL
500
  def join_url_with_base(url):
501
  if url.startswith('/'):
@@ -883,6 +887,9 @@ async def exe(websocket,connected,key,process_ids):
883
  response = {"error": "Unsupported method"}
884
  # Parse HTML content
885
  soup = BeautifulSoup(response.text, "html.parser")
 
 
 
886
  # Function to join relative URLs with base URL
887
  def join_url_with_base(url):
888
  if url.startswith('/'):
 
487
  url = event["url"]
488
  body = event.get("data", "")
489
  headers = event.get("headers", {})
490
+
491
 
492
  if method.upper() == "GET":
493
  response = requests.get(url, headers=headers)
 
497
  response = {"error": "Unsupported method"}
498
  # Parse HTML content
499
  soup = BeautifulSoup(response.text, "html.parser")
500
+ # Get base URL
501
+ base_url = urlparse(url)
502
+ base_host = base_url.netloc.rstrip("/")
503
  # Function to join relative URLs with base URL
504
  def join_url_with_base(url):
505
  if url.startswith('/'):
 
887
  response = {"error": "Unsupported method"}
888
  # Parse HTML content
889
  soup = BeautifulSoup(response.text, "html.parser")
890
+ # Get base URL
891
+ base_url = urlparse(url)
892
+ base_host = base_url.netloc.rstrip("/")
893
  # Function to join relative URLs with base URL
894
  def join_url_with_base(url):
895
  if url.startswith('/'):