python-plexapi: Can't connect to server on friend account.

I can connect just fine with admin account (server owner). But if i try to connect to friend accout i get error:

Traceback (most recent call last):

  File "C:\Users\Boris\Desktop\proba.py", line 3, in <module>

    plex = account.resource('Plex').connect()

  File "C:\Users\Boris\AppData\Local\Programs\Python\Python38-32\lib\site-packages\plexapi\myplex.py", line 963, in connect

    return _chooseConnection('Resource', self.name, results)

  File "C:\Users\Boris\AppData\Local\Programs\Python\Python38-32\lib\site-packages\plexapi\myplex.py", line 1296, in _chooseConnection

    raise NotFound('Unable to connect to %s: %s' % (ctype.lower(), name))

plexapi.exceptions.NotFound: Unable to connect to resource: Plex

“Plex” is a server name. Both client and server are on local network.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 29

Most upvoted comments

Yes you can close it. Thank you again for your help.

The config file needs to be created by the user. Anyway you can use logging and just grab the console output.

Add this at the top of your script:

import logging logging.basicConfig(level=logging.DEBUG)

Plex also provides an article for how to find your token. Safe to close?

@Dr0bac MyPlexAccount connects to Plex first, just like when you use plex.tv. Then it looks for the server. If you want to connect directly to your server with from a friends account you can use this snippet.

plex = PlexServer(PLEX_URL, PLEX_TOKEN)  # Admin token
account = plex.myPlexAccount()
user_acct = account.user('USERNAME') # Friend's username
user_plex = PlexServer(PLEX_URL, user_acct.get_token(plex.machineIdentifier))

INFO:plexapi:Testing 0 resource connections.. Looks like that account has no servers shared, remote access is disabled or blocked, or the server is otherwise unavailable.

I mentioned remote access before. Some more information about accounts and tokens can be found in that same thread, here.

@Dr0bac try this snippet filling the correct mail and passwd:

from plexapi.myplex import MyPlexAccount
account = MyPlexAccount('testvesna123@gmail.com', '<PASSWORD>')
plex = account.resource('Plex').connect()