How to activate my python code in Freshdesk

I am working on integrating Freshdesk with Grandstream. The goal is for Freshdesk to automatically create a ticket with information provided by Grandstream whenever a phone call is active.

I have developed a Python script to integrate the Grandstream system with Freshdesk. The purpose of this code is to extract information from the Grandstream system and use it to create tickets in the Freshdesk system. Below is a sample of the code:

import requests
import base64

def create_freshdesk_ticket(api_key, domain, subject, description, requester_id):
url = f’https://{domain}/api/v2/tickets’

headers = {
    'Content-Type': 'application/json',
    'Authorization': f'Basic {base64.b64encode(api_key.encode()).decode()}'
}

# Correct request format using requester_id directly
data = {
    "subject": subject,
    "description": description,
    "priority": 1,  # Adjust priority as needed
    "status": 2,  # Open status
    "requester": requester_id  # Pass requester_id directly (no nested 'id' key)
}

response = requests.post(url, json=data, headers=headers)
return response.json()

Example usage

api_key = ‘API’
domain = ‘Domain’
username = ‘@’
password = ‘@’
subject = “new ticket”
description = “Call received frome VOIP phone.”
requester_id = 11111 # Replace with the actual requester ID

response = create_freshdesk_ticket(api_key, domain, subject, description, requester_id)
print(response)

who can I activate this code in freshdesk.