Skip to content

HTTP Error 405: Method Not Allowed #14

@xzeldon

Description

@xzeldon

Hi, thanks for your work on this project.

I encountered an error similar to the one described in #10. When the application attempts to search for tracks using the Subsonic driver, it fails with an HTTP Error 405: Method Not Allowed.

Traceback:

Traceback (most recent call last):
  File "D:\Storage\dev\python\spotify-playlist-to-navidrome\.venv\Lib\site-packages\tunesynctool\drivers\common\subsonic\driver.py", line 150, in search_tracks
    response = self.__subsonic.search2(
        query=query,
    ...<2 lines>...
        songCount=limit,
    )
  File "D:\Storage\dev\python\spotify-playlist-to-navidrome\.venv\Lib\site-packages\libsonic\connection.py", line 532, in search2
    res = self._doInfoReq(req)
  File "D:\Storage\dev\python\spotify-playlist-to-navidrome\.venv\Lib\site-packages\libsonic\connection.py", line 2745, in _doInfoReq
    res = self._opener.open(req)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.13_3.13.496.0_x64__qbz5n2kfra8p0\Lib\urllib\request.py", line 495, in open
    response = meth(req, response)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.13_3.13.496.0_x64__qbz5n2kfra8p0\Lib\urllib\request.py", line 604, in http_response  
    response = self.parent.error(
        'http', request, response, code, msg, hdrs)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.13_3.13.496.0_x64__qbz5n2kfra8p0\Lib\urllib\request.py", line 533, in error
    return self._call_chain(*args)
           ~~~~~~~~~~~~~~~~^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.13_3.13.496.0_x64__qbz5n2kfra8p0\Lib\urllib\request.py", line 466, in _call_chain    
    result = func(*args)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.13_3.13.496.0_x64__qbz5n2kfra8p0\Lib\urllib\request.py", line 613, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 405: Method Not Allowed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\Storage\dev\python\spotify-playlist-to-navidrome\main.py", line 39, in <module>
    matched_track = matcher.find_match(track)
  File "D:\Storage\dev\python\spotify-playlist-to-navidrome\.venv\Lib\site-packages\tunesynctool\features\track_matcher.py", line 36, in find_match
    matched_track = self.__search_with_text(track)
  File "D:\Storage\dev\python\spotify-playlist-to-navidrome\.venv\Lib\site-packages\tunesynctool\features\track_matcher.py", line 98, in __search_with_text 
    results.extend(self._target.search_tracks(
                   ~~~~~~~~~~~~~~~~~~~~~~~~~~^
        query=query,
        ^^^^^^^^^^^^
        limit=10
        ^^^^^^^^
    ))
    ^
  File "D:\Storage\dev\python\spotify-playlist-to-navidrome\.venv\Lib\site-packages\tunesynctool\drivers\common\subsonic\driver.py", line 165, in search_tracks
    raise ServiceDriverException(e)
tunesynctool.exceptions.ServiceDriverException: HTTP Error 405: Method Not Allowed

Configuration (.env):

SPOTIFY_CLIENT_ID='xxx'
SPOTIFY_CLIENT_SECRET='xxx'
SPOTIFY_REDIRECT_URI='http://127.0.0.1:9999/callback'
SUBSONIC_BASE_URL='http://192.168.1.27:4533/music'
# Tried with SUBSONIC_PORT=4533 and without it
SUBSONIC_USERNAME='xxx'
SUBSONIC_PASSWORD='xxx'

Cause:

The HTTP 405 error occurs when Navidrome is started with the ND_BASEURL environment variable set (e.g., ND_BASEURL="/music").

Workaround:

Remove the ND_BASEURL environment variable from your Navidrome server configuration/startup command. Then, ensure the SUBSONIC_BASE_URL in your .env points to Navidrome's base address without the extra path (e.g., SUBSONIC_BASE_URL='http://192.168.1.27:4533').

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions