How to upload file from python Flask web app to Supabase Storage

from storage3 import create_client

url = ""
key = ""
headers = {"apiKey": key, "Authorization": f"Bearer {key}"}
storage_client = create_client(url, headers, is_async=False)

def upload_file(self):
    if 'file' not in request.files:
        flash('No file part')
        return redirect('/')
    file = request.files['file']
    if file.filename == '':
        flash('No selected file')
        return redirect('/')
    filename = secure_filename(file.filename)

    buckets = storage_client.list_buckets()
    bucket = buckets[0]
    return bucket.upload(filename, file)