Custom action with Google Sheets

Hello, I need some help. I create custom action in my rasa project. here is the code:

-- coding: utf-8 --

from future import absolute_import from future import division from future import print_function from future import unicode_literals

import logging import requests import json from rasa_core_sdk import Action from rasa_core_sdk.events import SlotSet

import gspread from oauth2client.service_account import ServiceAccountCredentials

logger = logging.getLogger(name)

class ActionCheckPaidLeave(Action):

def name(self):
    # define the name of the action which can then be included in training stories
    return "paid_leave"

def run(self, dispatcher, tracker, domain):	
    # Get info from google sheet
	scope = ['https://spreadsheets.google.com/feeds', 'https://www.googleapis.com/auth/drive']
	creds = ServiceAccountCredentials.from_json_keyfile_name('/key/key_google_API.json', scope) 
	client = gspread.authorize(creds)
	sheet = client.open('AAA').sheet1
	legistrators = sheet.get_all_records()
	dispatcher.utter_message(legistrators)

but when I use it, I get error: Failed to run custom action ‘paid_leave’. Action server responded with a non 200 status code of 500. Make sure your action server properly runs actions and returns a 200 once the action is executed. Error: 500 Server Error: INTERNAL SERVER ERROR for url: http://localhost:5055/webhook

Thanks in advance :grinning: !