How to access remote server via plugin?



I'm working on my first plugin and have a rather basic problem that is blocking me...

My plugin will be processing a playlist that can be on a remote server, however I haven't been able to figure out how to reach the remote server. When I pull "/servers" from my "", it only shows me my local server, when I expect that it would show me all servers I have access to.

Is there a different command for accessing remote servers? Anybody know of an existing plugin I could browse through that connects to a remote server?






Also note, that you NEVER EVER should add the Plex token to the URL, since it then would be logged in the channel logs!

Instead, add it as a header

Best Regards



Following up in here (but may be worth a new thread), I've been able to build the interface to select the remote server now, but when I try to do XML.ElementFromURL calls to that server (using the IP/port/token extracted from pms/servers), I get the exception "Accessing the media server's HTTP interface is not permitted." If I just paste the URL I am using into a browser, the XML does come up fine. Some of the URLs I've been trying that have been causing this are:


I gather there is another library like PMS that I should be using instead?


@edank I've seen this error before. Plex server normally does not allow request to itself or other Plex servers via its API for some reason.

Here are some lines from of Plex Framework that I believe are throwing that error:

def Request(self, url, values=None, headers={}, cacheTime=None, encoding=None, errors=None, timeout=GLOBAL_DEFAULT_TIMEOUT, immediate=False, sleep=0, data=None, follow_redirects=True, method=None): 
    if url.find(':32400/') > -1 and self._sandbox.policy.elevated_execution == False:
      raise Framework.exceptions.FrameworkException("Accessing the media server's HTTP interface is not permitted.")

I have absolutely no idea why the restriction is in place, but the code also contains a hint for the solution: you could put your channel into elevated code policy. It will grant you more power over what kind of code your channel may execute and access to more Framework functions. But I hear that it could cause your channel to be rejected from the official Plex channels repository, should you decide to publish it there.

In order to enable it, you'll need to add the following keys to the channel's Info.plist and restart Plex Server:


Or alternatively, you could just use raw Python HTTP requests using eg urllib2.urlopen and avoid changing the code policy.


Thank you @czukowski , I'll give those a shot!