TypeError: ‘method’ object is not subscriptable
Below is the action method i am using: class Action_carona_tracker(Action):
def name(self) -> Text:
return "action_carona_tracker"
def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
response = requests.get("https://api.covid19india.org/data.json").json
entities = tracker.latest_message['entities']
print("last message now",entities)
state = None
for e in entities:
if e['entity']== 'state':
state=e['value']
for data in response["statewise"]:
if data["state"] == state.title():
print(data)
dispatcher.utter_message(text="Hello World!"+data)
return []
error details: events = action(dispatcher, tracker, domain) File “C:\Users\LENOVO\Desktop\slot\actions.py”, line 46, in run for data in response[“statewise”]: TypeError: ‘method’ object is not subscriptable