Most likely, the problem with the script that you sent in the question , you cannot do directly:
conn=httplib.HTTPConnection("http://223.56.124.58:8080/wireless")
The exception is getaddrinfo() in getaddrinfo() , which calls the getaddrinfo() C function, which returns EAI_NONAME :
node or service is unknown; or both node, and the service is NULL; or AI_NUMERICSERV was specified in hints.ai_flags, and the service was not a numeric string of the port number. "
Obviously, there is a problem with the parameters passed to getaddrinfo , and most likely you are trying to get information for the host "223.56.124.58:8080/wireless" . Email Oh!
Indeed, you cannot directly connect to the URL. Since the documentation is clearly indicated and displayed , you are connecting to the server:
conn = httplib.HTTPConnection("223.56.124.58", 8080)
Then you can do:
conn.request("POST", "wireless", params, headers)
What about the script you're actually using ?
conn.request("POST","http://202.45.139.58:8080/ppod-web",params,headers)
Even if the connection was correctly formed, you will have POSTing to http://202.45.139.58:8080/http://202.45.139.58:8080/ppod-web . You probably really want:
conn = httplib.HTTPConnection("202.45.139.58", 8080) conn.request("POST", "ppod-web", params, headers)
An error is shown for this line, since most likely the HTTPConnection is a lazy object and only tries to actually connect to the server when calling request() .
After you finish the installation above, you need to fix params .
>>> urllib.urlencode({"wifi":{"ssid":"guest","rssi","80"}}) SyntaxError: invalid syntax >>> urllib.urlencode({"wifi":{"ssid":"guest","rssi":"80"}}) 'wifi=%7B%27rssi%27%3A+%2780%27%2C+%27ssid%27%3A+%27guest%27%7D'
To get what you think you want to receive, you must do:
>>> urllib.urlencode({"data": {"wifi":{"ssid":"guest","rssi":"80"}}}) 'data=%7B%27wifi%27%3A+%7B%27rssi%27%3A+%2780%27%2C+%27ssid%27%3A+%27guest%27%7D%7D'