Deafault code does not work to send email via python and mailgun

Hi., I used this default code to send an email when the value of temperature is higher or lower than the threshold. I get an error saying
Traceback (most recent call last):
File “”, line 17, in
print ("Sensor value is: " + str(data[‘value’]))
KeyError: ‘value’

THe code is as follows:

import email_conf
from boltiot import Email, Bolt
import json, time

minimum_limit = 300 #the minimum threshold of light value
maximum_limit = 600 #the maximum threshold of light value

mybolt = Bolt(email_conf.API_KEY, email_conf.DEVICE_ID)
mailer = Email(email_conf.MAILGUN_API_KEY, email_conf.SANDBOX_URL, email_conf.SENDER_EMAIL, email_conf.RECIPIENT_EMAIL)

while True:
print (“Reading sensor value”)
response = mybolt.analogRead(‘A0’)
data = json.loads(response)
print ("Sensor value is: " + str(data[‘value’]))
sensor_value = int(data[‘value’])
if sensor_value > maximum_limit or sensor_value < minimum_limit:
print(“Making request to Mailgun to send an email”)
response = mailer.send_email(“Alert”, "The Current temperature sensor value is " +str(sensor_value))
response_text = json.loads(response.text)
print("Response received from Mailgun is: " + str(response_text[‘message’]))
except Exception as e:
print (“Error occured: Below are the details”)
print (e)

I have a separate file names as email conf which has the credentials. Please tell me where is the problem as this is the drfault code

PS: I i just print out the data vairiable, then the result i get is {‘message’: ‘A Connection error occurred’, ‘success’: ‘0’}. But my module has both the leds on and even on the clound dashboard it says that the device is online. Also if i try to read the analog input by using the api -, then i can see the value of the sensor.
Error on deafault code:
Value of data which is the response we get from bolt
But it shows the value of the sensor usign api.

@jindaldhruva Can you check what the variable data is by printing it on the screen? It may be possible that you have been rate limited.

Please see the question now. I have updated it . It now mentions that the data variable shows connection eroor but through api i am able to read analog sensor value and i am not rate limited