Kodi Community Forum

Full Version: Connection refused on localhost(python)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, my problem is when i want to control(with python) my kodi(krypton) on my RPi2, At the beginning i tried with simulate the keypress, but it didnt work. then i wanted to to use JSONRPC but i get connection refused error, but when i open the "link" in my win10 broswer its work perfect.
I tried with TCP but i got the same error.

The Code: https://pastebin.com/aAZY44AU
(2017-12-24, 19:27)kyrat Wrote: [ -> ]Hi, my problem is when i want to control(with python) my kodi(krypton) on my RPi2, At the beginning i tried with simulate the keypress, but it didnt work. then i wanted to to use JSONRPC but i get connection refused error, but when i open the "link" in my win10 broswer its work perfect.
I tried with TCP but i got the same error.

The Code: https://pastebin.com/aAZY44AU
If you're doing JSONRPC over the HTTP connection, there is almost certainly a username and password.  By default it's kodi/kodi and is set in Settings > Service Settings > Control under the Webserver section.  I wonder if at some point you entered the username/password and saved them on your windows browser.  I don't see them being passed in the python code you posted.
(2017-12-24, 21:30)pkscout Wrote: [ -> ]
(2017-12-24, 19:27)kyrat Wrote: [ -> ]Hi, my problem is when i want to control(with python) my kodi(krypton) on my RPi2, At the beginning i tried with simulate the keypress, but it didnt work. then i wanted to to use JSONRPC but i get connection refused error, but when i open the "link" in my win10 broswer its work perfect.
I tried with TCP but i got the same error.

The Code: https://pastebin.com/aAZY44AU
If you're doing JSONRPC over the HTTP connection, there is almost certainly a username and password.  By default it's kodi/kodi and is set in Settings > Service Settings > Control under the Webserver section.  I wonder if at some point you entered the username/password and saved them on your windows browser.  I don't see them being passed in the python code you posted. 
 yapp, i know. I removed ursname, and pw. I wrote, i can use  from another pc, http get worked( http://192.168.1.75:8080/jsonrpc?request={"jsonrpc":%20"2.0",%20"id":%201,%20"method":%20"Input.Up"}) but on localhost(same machine running kodi) didnt work
(2017-12-24, 21:37)kyrat Wrote: [ -> ]
(2017-12-24, 21:30)pkscout Wrote: [ -> ]
(2017-12-24, 19:27)kyrat Wrote: [ -> ]Hi, my problem is when i want to control(with python) my kodi(krypton) on my RPi2, At the beginning i tried with simulate the keypress, but it didnt work. then i wanted to to use JSONRPC but i get connection refused error, but when i open the "link" in my win10 broswer its work perfect.
I tried with TCP but i got the same error.

The Code: https://pastebin.com/aAZY44AU
If you're doing JSONRPC over the HTTP connection, there is almost certainly a username and password.  By default it's kodi/kodi and is set in Settings > Service Settings > Control under the Webserver section.  I wonder if at some point you entered the username/password and saved them on your windows browser.  I don't see them being passed in the python code you posted.  
 yapp, i know. I removed ursname, and pw. I wrote, i can use  from another pc, http get worked( http://192.168.1.75:8080/jsonrpc?request={"jsonrpc":%20"2.0",%20"id":%201,%20"method":%20"Input.Up"}) but on localhost(same machine running kodi) didnt work 
You'll have to post a Kodi debug log then.  I've never seen any setting in Kodi that would allow you remote access but not local access, so you might also look to see if you have something on the Pi that's restricting local access.
Here is 2 log file:
1st when i used chrome on another pc: https://pastebin.com/M69iR7fC
2nd use python program:                     https://pastebin.com/Q2m6TZPG
(2017-12-25, 22:04)kyrat Wrote: [ -> ]Here is 2 log file:
1st when i used chrome on another pc: https://pastebin.com/M69iR7fC
2nd use python program:                     https://pastebin.com/Q2m6TZPG
 All I can say for sure is that Kodi is never seeing the call from your python code, so it's getting refused somewhere else.  Is the python code running on the Pi or the same computer on which you're trying the link from your web browser?  If it's on the Pi, it might be worth trying localhost instead of the IP address.  There might be a loopback issue on the Pi.