vinylemulator icon indicating copy to clipboard operation
vinylemulator copied to clipboard

500 error from terminal, but 200 from browser

Open mbecker4 opened this issue 3 years ago • 4 comments

I'm hitting the endpoint on my raspberry pi with python trying to play a song in the living room with the following:

r = requests.get('http://localhost:5005/Living%20Room/applemusic/now/album:370090822')

When running in terminal I get a 500 {"status":"error"}

However when I copy the exact url and paste it into a browser it works and I get {"status":"success"}

I am still relatively new to python so I'm hoping I didn't overlook something obvious. But any clarification on why this would be happening would be much appreciated.

mbecker4 avatar Oct 13 '21 01:10 mbecker4

This is unusual. Your code looks fine to me.

If I were you I would try checking that requests can access other pages (eg http://localhost:5005/) to see whether the issue is with accessing the server or with the specific URL.

You could also try it with a space rather than the %20 to see if that is causing an issue.

Sent via Superhuman ( @.*** )

On Wed, Oct 13, 2021 at 02:18:41, Matthew Becker < @.*** > wrote:

I'm hitting the endpoint on my raspberry pi with python trying to play a song in the living room with the following:

r = requests.get('http://localhost:5005/Living%20Room/applemusic/now/album:370090822')

When running in terminal I get a 500 {"status":"error"}

However when I copy the exact url and paste it into a browser it works and I get {"status":"success"}

I am still relatively new to python so I'm hoping I didn't overlook something obvious. But any clarification on why this would be happening would be much appreciated.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub ( https://github.com/hankhank10/vinylemulator/issues/24 ) , or unsubscribe ( https://github.com/notifications/unsubscribe-auth/AGCVMWJLW35PA2P23CG764LUGTM7DANCNFSM5F37WJBA ).

hankhank10 avatar Oct 13 '21 06:10 hankhank10

After some additional troubleshooting I rebooted everything. Unplugged/and replugged in the Sonos, rebooted my wifi, and rebooted the raspberry pi. I am able to now hit 'http://localhost:5005/zones and get the proper response but when I try to play any music I am now getting this 500 error

{"status":"error","error":"Got status 500 when invoking /MediaRenderer/AVTransport/Control","stack":"Error: Got status 500 when invoking /MediaRenderer/AVTransport/Control\n at Object.invoke (/home/pi/node-sonos-http-api/node_modules/sonos-discovery/lib/helpers/soap.js:99:10)\n at Player.addURIToQueue (/home/pi/node-sonos-http-api/node_modules/sonos-discovery/lib/models/Player.js:616:15)\n at /home/pi/node-sonos-http-api/lib/actions/appleMusic.js:55:50\n at processTicksAndRejections (node:internal/process/task_queues:94:5)"}

mbecker4 avatar Oct 13 '21 11:10 mbecker4

This is an error from the node-sonos-http-api library so I suggest you post an issue there: https://github.com/jishi/node-sonos-http-api

Sent via Superhuman ( @.*** )

On Wed, Oct 13, 2021 at 12:27:09, Matthew Becker < @.*** > wrote:

After some additional troubleshooting I rebooted everything. Unplugged/and replugged in the Sonos, rebooted my wifi, and rebooted the raspberry pi. I am able to now hit 'http://localhost:5005/zones and get the proper response but when I try to play any music I am now getting this 500 error

{"status":"error","error":"Got status 500 when invoking /MediaRenderer/AVTransport/Control","stack":"Error: Got status 500 when invoking /MediaRenderer/AVTransport/Control\n at Object.invoke (/home/pi/node-sonos-http-api/node_modules/sonos-discovery/lib/helpers/soap.js:99:10)\n at Player.addURIToQueue (/home/pi/node-sonos-http-api/node_modules/sonos-discovery/lib/models/Player.js:616:15)\n at /home/pi/node-sonos-http-api/lib/actions/appleMusic.js:55:50\n at processTicksAndRejections (node:internal/process/task_queues:94:5)"}

— You are receiving this because you commented. Reply to this email directly, view it on GitHub ( https://github.com/hankhank10/vinylemulator/issues/24#issuecomment-942202965 ) , or unsubscribe ( https://github.com/notifications/unsubscribe-auth/AGCVMWKZNI7D6V4BLSHNHVLUGVUI3ANCNFSM5F37WJBA ).

hankhank10 avatar Oct 13 '21 11:10 hankhank10

Okay, I ran down that trail and did a ton of troubleshooting it seems the problem is with the

r = requests.get(urltoget) which tracing back I found it was a problem with the sonosinstructions tracing that back I found that the problem is with the receivedtext[11:]

if I do r=requests.get(user settings.sonoshttpaddress + '/' + sonosroom_local + '/applemusic/now/album:370090822') it works flawlessly.

I've attempted trying making a new variable to isolate just the album id and double check that it is a string but that didn't work either.

Is there anything else that I should be doing to get that id to play nice? or is this also being caused by node-sones-http-api?

mbecker4 avatar Oct 14 '21 01:10 mbecker4