urllib2.HTTPError: HTTP Error 404?

I try to execute the blynk_valueDisplay.py as below by following the suggested steps. However, I got the ‘urllib2.HTTPError: HTTP Error 404: Not Found’. Can anyone help me solve this problem. Thank you so much.

# 1. update opkg & disable bridge & commit& reboot
# 	 opkg update
# 	 uci set yunbridge.config.disabled=0
# 	 uci commit
#    reboot
# Reference
#    http://docs.blynkapi.apiary.io/#reference
# ************************************************************************************************************

from urllib2 import Request, urlopen
import time
import sys

sys.path.insert(0, '/usr/lib/python2.7/bridge/') 
from bridgeclient import BridgeClient as bridgeclient

auth_token = "xxxxxxxxx"
input_pin = "V0"

while True:
    value = bridgeclient()
    t0 = value.get("t")
    h0 = value.get("h")
    print "Temp: " + t0
    print "Humi: " + h0

    requestString = "http://blynk-cloud.com/" + auth_token + "/update/" + input_pin + "?value=" + t0
    print "requestString: " + requestString
    # http://blynk-cloud.com/9417dea3d1a248549cf3df7008785282/update/V0?value=1234

    request = Request(requestString)
    response_body = urlopen(request).read()
    print response_body

root@mylinkit:~# python blynk_valueDisplay.py
Temp:  NAN
Humi:  NAN
requestString: http://blynk-cloud.com/xxxxxxxxxx/update/V0                                                                                                                                                             ?value= NAN
Traceback (most recent call last):
  File "blynk_valueDisplay.py", line 40, in <module>
    response_body = urlopen(request).read()
  File "/usr/lib/python2.7/urllib2.py", line 154, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python2.7/urllib2.py", line 437, in open
    response = meth(req, response)
  File "/usr/lib/python2.7/urllib2.py", line 550, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python2.7/urllib2.py", line 475, in error
    return self._call_chain(*args)
  File "/usr/lib/python2.7/urllib2.py", line 409, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 558, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 404: Not Found

NAN = not a number, what do you get if you send 1234 rather than t0?

Thank you for your reply.

if value = 1234, the result of execution is

Temp: NAN
Humi: NAN
Traceback (most recent call last):
File “blynk_valueDisplay.py”, line 35, in
requestString = “http://blynk-cloud.com/” + auth_token + “/update/” + input_pin + “?value=” + 1234
TypeError: cannot concatenate ‘str’ and ‘int’ objects

What can I do?

Learn to code :slight_smile:

Somewhere in your code you are trying to add a String to an integer, I haven’t looked where it is but I was just trying to point out your original problem that you weren’t sending a value to the API.

Post your revised code when you have fixed it.

The question is solved. The program (blynk_valueDisplay.py ) is well. The main problem is my DH11 sensor cannot work well.