Evertime i am getting same error why?

Traceback (most recent call last):
File β€œ/home/msis/.local/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py”, line 535, in _run_script
exec(code, module.dict)
File β€œ/home/msis/newminio_demo.py”, line 70, in
File β€œ/home/msis/newminio_demo.py”, line 48, in main
minio_client = connect_to_minio(endpoint_url, access_key, secret_key)
File β€œ/home/msis/newminio_demo.py”, line 8, in connect_to_minio
client = Minio(endpoint_url,
File β€œ/home/msis/.local/lib/python3.10/site-packages/minio/api.py”, line 152, in init
self._base_url = BaseURL(
File β€œ/home/msis/.local/lib/python3.10/site-packages/minio/helpers.py”, line 541, in init
url = _parse_url(endpoint)
File β€œ/home/msis/.local/lib/python3.10/site-packages/minio/helpers.py”, line 502, in _parse_url
raise ValueError(β€œpath in endpoint is not allowed”

If I had to guess I would say because your endpoint_url is wrong.

import streamlit as st
from minio import Minio
from minio.error import S3Error

Function to connect to MinIO server

def connect_to_minio(endpoint_url, access_key, secret_key):
client = Minio(endpoint_url,
secure=False) # Using HTTP, set to True if using HTTPS
return client
except S3Error as e:
st.error(f"Error: {e}")
return None

Function to list buckets

def list_buckets(minio_client):
buckets = minio_client.list_buckets()
return [bucket.name for bucket in buckets]
except S3Error as e:
st.error(f"Error: {e}")

Function to list objects in a bucket

def list_objects(minio_client, bucket_name):
objects = minio_client.list_objects(bucket_name, recursive=True)
return [obj.object_name for obj in objects]
except S3Error as e:
st.error(f"Error: {e}")

Main function to run the Streamlit app

def main():
st.title(β€œMinIO Explorer”)

# Sidebar for MinIO server connection details
st.sidebar.header("MinIO Connection")
endpoint_url = st.sidebar.text_input("MinIO Endpoint URL", "")
access_key = st.sidebar.text_input("Access Key", "")
secret_key = st.sidebar.text_input("Secret Key", "", type="password")
connect_button = st.sidebar.button("Connect to MinIO")

if connect_button:
    # Connect to MinIO server
    minio_client = connect_to_minio(endpoint_url, access_key, secret_key)
    if minio_client:
        st.sidebar.success("Connected to MinIO")
        # Display buckets
        buckets = list_buckets(minio_client)
        if buckets:
            selected_bucket = st.selectbox("Select a bucket", buckets)
            # Display objects in selected bucket
            st.subheader(f"Objects in {selected_bucket}")
            objects = list_objects(minio_client, selected_bucket)
            for obj in objects:
            st.warning("No buckets found.")
        st.error("Failed to connect to MinIO")

if name == β€œmain”:
like my code is working but why it shows error can one help me to find out the problem

Make sure endpoint_url is the URL of the target service.

my enpoint url is i gave in streamlit webapplication but still iam facing issue

I am puzzled, that url should not raise that error. I even gave it to the function _parse_url mentioned in the traceback and it ran without issues. Sorry, I am out of ideas.

  • The ip is not reachable?
  • Insecure connection via http not permitted?