Mailgun error-command timed out

Sir how to remove this error?

Hi, Please share your code with us. First copy and paste your code in the text box and then select the code part and like on this symbol </> .

Preformatted textimport requests,json,time

key=‘key-9c68bc34fb20725eedcfbbeca693e974’
sandbox=‘sandbox9afd65006b39471587ec6426ee92e1c6.mailgun.org
recipient=‘priyankachikane20@gmail.com’

def send_mail(body):
request_url=‘https://api.mailgun.net/v2/{0}/messages’.format(sandbox)
request=requests.post(request_url,auth=(‘api’,key),data={
‘from’:‘manalirajput56@gmail.com’,
‘to’:recipient,
‘subject’:‘obstacle detected’,
‘text’: body
})
print’Status: {0}’.format(request.status_code)
print’Body: {0}’.format(request.text)

while True:
r = requests.get(‘http://cloud.boltiot.com/remote/80f09d8d-78b5-4132-ac45-46a64b895dcd/digitalRead?pin=4&deviceName=BOLT1259126’)
print r.text
data = json.loads(r.text)
print data[‘value’]
try:
obstacle_detected = int(data[‘value’])
if obstacle_detected == 0:
send_mail(“Obstacle detected at” + str(time.time()))
except Exception as e:
print “Error”,e
time.sleep(5)

import requests,json,time

key='key-9c68bc34fb20725eedcfbbeca693e974'
sandbox='sandbox9afd65006b39471587ec6426ee92e1c6.mailgun.org'
recipient='priyankachikane20@gmail.com'

def send_mail(body):
    request_url='https://api.mailgun.net/v2/{0}/messages'.format(sandbox)
    request=requests.post(request_url,auth=('api',key),data={
    'from':'manalirajput56@gmail.com',
    'to':recipient,
    'subject':'obstacle detected',
    'text': body
    })
    print'Status: {0}'.format(request.status_code)
    print'Body:   {0}'.format(request.text)

while True:
    r = requests.get('http://cloud.boltiot.com/remote/80f09d8d-78b5-4132-ac45-46a64b895dcd/digitalRead?pin=4&deviceName=BOLT1259126')
    print r.text
    data = json.loads(r.text)
    print data['value']
    try:
        obstacle_detected = int(data['value'])
        if obstacle_detected == 0:
                send_mail("Obstacle detected at" + str(time.time()))
    except Exception as e:
        print "Error",e
    time.sleep(5)

Sir please reply as soon as possible

Hi ,
Your code seems fine. Can you please update your bolt device firmware.
because Cloud is not able to read the digital value from bolt device.
There are two possible reasons for that.

  1. You are using the Old firmware of bolt.
  2. Your device is not connected to the internet enabled Wi-Fi network
    {“value”: “Command timed out”, “success”: “0”}

To update your bolt type bolt_ip/update
For example: 192.168.2.4/update

To check if your device is conneted to cloud-
http://cloud.boltiot.com/remote/7df390dc-a715-4a2a-8ad3-08eefa6fcb70/isAlive?&deviceName=BOLT8795377
(Replace API key and device Name with your device name) .

Let me know in case you need further assitance.