python-plexapi: Cannot control client : 406 error

Hi,

i try to control a plex client (PMP on a RPI) using python-plexapi.

I get a token after using plex-listtokens.py. The tool list many object : Ressources, Devices and one client (my PMP RPI). My Plex Media Server (Ressource) has the same token than my Plex Media Player (Client).

I made a small python script, where the baseurl is the url of my plex server. When i print the clients list, i can see my client with the title “PlexMediaPlayer”. As a result of this script, i always get a 406 error code, with this trace :

PlexMediaPlayer
Traceback (most recent call last):
  File "./test.py", line 16, in <module>
    client.goToHome()
  File "/usr/local/lib/python2.7/dist-packages/plexapi/client.py", line 216, in goToHome
    self.sendCommand('navigation/home')
  File "/usr/local/lib/python2.7/dist-packages/plexapi/client.py", line 192, in sendCommand
    return self.query(key, headers=headers)
  File "/usr/local/lib/python2.7/dist-packages/plexapi/client.py", line 164, in query
    raise BadRequest('(%s) %s; %s %s' % (response.status_code, codename, response.url, errtext))
plexapi.exceptions.BadRequest: (406) not_acceptable; http://10.0.1.35:32433/player/navigation/home?commandID=1&X-Plex-Token=[MY TOKEN]

Is there any step i did forget to control my client ? (i can navigate into my library thru the PlexServer object, list all my movies…)

#!/usr/bin/env python3

from plexapi.server import PlexServer

baseurl = 'http://10.0.1.41:32400'
token = '[MY TOKEN]'
plex = PlexServer(baseurl, token)

for client in plex.clients():
    print(client.title)

client = plex.client("PlexMediaPlayer")

client.connect()

client.goToHome()

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 22 (3 by maintainers)

Most upvoted comments

@doodah33 Today 😃 hopefully 😉