crustymonkey / py-sonic

A python library to wrap the Subsonic REST API
http://stuffivelearned.org/doku.php?id=programming:python:py-sonic
GNU General Public License v3.0
56 stars 26 forks source link

Fallback to pre-1.13.0 authentication when not supported #17

Closed hhm0 closed 8 years ago

hhm0 commented 8 years ago

Some subsonic-compatible servers (for example supysonic) deliberately only support pre-1.13.0 authentication.

Since pre-1.13 auth is no longer works with py-sonic (last compatible commit was ad9d24d), it would be awesome to have py-sonic fall back to using pre-1.13.0 authentication either on authentication errors, and/or when a parameter is provided to Connection.

Thanks for the wonderful library!

crustymonkey commented 8 years ago

Yeah, I'm definitely down for making it an option. I'm not so sure about an automated fallback (unless it was a specific option) as I'd rather not drop the security on people without their knowledge.

Work is super busy this week, but I'm hoping to have the time to spend on some personal projects next week.

Thanks for the suggestion.

On 08/23/2016 10:23 PM, hhm0 wrote:

Some subsonic-compatible servers (for example supysonic https://github.com/spl0k/supysonic/issues/36#issuecomment-131389118) deliberately only support pre-1.13.0 authentication.

It would therefore be awesome to have py-sonic fall back to using pre-1.13.0 authentication either on authentication errors, and/or when a parameter is provided to |Connection|.

Thanks for the wonderful library!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/crustymonkey/py-sonic/issues/17, or mute the thread https://github.com/notifications/unsubscribe-auth/AAgHcuEa08zD_AGKsWjFJru3L-dIN9F0ks5qi9VXgaJpZM4JrpUu.

crustymonkey commented 8 years ago

@hhm0 I've added an auth_options branch that contains a legacyAuth option as a Connection argument. This will use the pre-1.13.0 auth mechanism. I've tested against my 6.0 server and it works well. Can you pull that branch and give it a try? If your testing looks good, I'll merge this into master.

crustymonkey commented 8 years ago

I've merged this into master and created a new version (0.6.1). Feel free to re-open the task if you have issues using the new legacyAuth option.

hhm0 commented 8 years ago

Yes, it works! Thanks so much! :-)

On 9/24/16, Jay Deiman notifications@github.com wrote:

Closed #17.

You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/crustymonkey/py-sonic/issues/17#event-801323180

mrpurplenz commented 8 years ago

It didnt solve the problem for Ampache/subsonic. pysonic now reports the more informative error: libsonic.errors.VersionError: Incompatible Subsonic REST protocol version. Server must upgrade. I have opend an issue with ampache at https://github.com/ampache/ampache/issues/1389 but thought it worth while to mention and link to it here.

crustymonkey commented 8 years ago

Have you tried manually setting the apiVersion option of the Connection object? That will change what is sent to the server.

mrpurplenz commented 8 years ago

Yes that worked. So the error message was comming in as a result of ampache detecting an api version incompatibility. Perhaps the appropriate legacy version could be passed as the legacyAuth parameter? Allowing connection.py to report whichever version was supplied? Or is that bad practice? Or maybe just switch to 1.11.0 on detection of the legacyAuth parameter?

crustymonkey commented 8 years ago

Technically, the legacyAuth is actually 1.13.0 and earlier. I think I would rather leave things the way they are as the apiVersion override is simple and pretty straightforward to use.

As an alternative, and I think I would still make this an option, I think it would be reasonable to handle the version error where the server is lower than the client and auto set that. The error code "30" is the mentioned error and part of the error message contains the server version. This would be fairly easy to handle, and then force a retry.

I've opened https://github.com/crustymonkey/py-sonic/issues/19 for this issue

ghost commented 2 years ago

I have a problem related to this, when trying to connect to my LMS server. It results in an error message libsonic.errors.ParameterError: Required parameter 'p' is missing.

crustymonkey commented 2 years ago

@metalune1

LMS server

What is this? Can you provide a code snippet as an example of what you are doing?

ghost commented 2 years ago

oh sorry, LMS stands for Lightweight Music Server (https://github.com/epoupon/lms) but either way this is deprecated, I had to set legacyAuth=True

crustymonkey commented 2 years ago

Ok, so, just to be clear, legacyAuth=True worked for the issue you were having?

ghost commented 2 years ago

yeah, it resolved my issue :) ------- Original Message ------- On Wednesday, June 29th, 2022 at 6:35 PM, Jay Deiman @.***> wrote:

Ok, so, just to be clear, legacyAuth=True worked for the issue you were having?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>