How to delete a User using Python

Hi, I am new to gitea. I created a user as part of a task to automate some things. I want to know how to delete the user I created using a Python script. I have tried writing a script to delete but I am getting
No connection could be made because the target machine actively refused it. code for deleting a user is as follows:

import giteapy
from import ApiException
import pprint
configuration = giteapy.Configuration() configuration.api_key['access_token'] = 'token' 
configuration.api_key['Authorization'] = 'token' 
api_instance = giteapy.AdminApi(giteapy.ApiClient(configuration=configuration)) 
   api_response = api_instance.admin_delete_user('') 
except ApiException as e: 

How do I solve this? Is there any other way to delete the user I created.

I am not familiar with this library, but in that code snippet you have not specified your Gitea instance’s URL. It is probably defaulting to localhost:3000 so it is trying to connect to Gitea as if it was running on your local computer.