How to use the plexapi.CONFIG.get function in PlexAPI

To help you get started, we’ve selected a few PlexAPI examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pkkid / python-plexapi / tools / plex-download.py View on Github external
# Connect to the server and fetch the item
    servers = [r for r in account.resources() if r.clientIdentifier == clientid]
    if len(servers) != 1:
        raise SystemExit('Unknown or ambiguous client id: %s' % clientid)
    server = servers[0].connect()
    return server.fetchItem(key)
	
if __name__ == '__main__':
    # Command line parser
    from plexapi import CONFIG
    from tqdm import tqdm
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument('-u', '--username', help='Your Plex username',
                        default=CONFIG.get('auth.myplex_username'))
    parser.add_argument('-p', '--password', help='Your Plex password',
                        default=CONFIG.get('auth.myplex_password'))
    parser.add_argument('--url', default=None, help='Download from URL (only paste after !)')	
    opts = parser.parse_args()
    # Search item to download
    account = utils.getMyPlexAccount(opts)
    items = search_for_item(opts.url)
    for item in items:
        for part in item.iterParts():
            # We do this manually since we dont want to add a progress to Episode etc
            filename = '%s.%s' % (item._prettyfilename(), part.container)
            url = item._server.url('%s?download=1' % part.key)
            filepath = utils.download(url, token=account.authenticationToken, filename=filename, savepath=os.getcwd(),
                                      session=item._server._session, showstatus=True)
            #print('  %s' % filepath)
github guirem / plugin-googlecast / resources / plexapi / server.py View on Github external
def __init__(self, baseurl=None, token=None, session=None, timeout=None):
        self._baseurl = baseurl or CONFIG.get('auth.server_baseurl', 'http://localhost:32400')
        self._baseurl = self._baseurl.rstrip('/')
        self._token = logfilter.add_secret(token or CONFIG.get('auth.server_token'))
        self._showSecrets = CONFIG.get('log.show_secrets', '').lower() == 'true'
        self._session = session or requests.Session()
        self._library = None   # cached library
        self._settings = None   # cached settings
        self._myPlexAccount = None   # cached myPlexAccount
        data = self.query(self.key, timeout=timeout)
        super(PlexServer, self).__init__(self, data, self.key)
github Haynie-Research-and-Development / jarvis / deps / lib / python3.4 / site-packages / plexapi / myplex.py View on Github external
def _signin(self, username, password, timeout):
        if self._token:
            return self.query(self.key), self.key
        username = username or CONFIG.get('auth.myplex_username')
        password = password or CONFIG.get('auth.myplex_password')
        data = self.query(self.SIGNIN, method=self._session.post, auth=(username, password), timeout=timeout)
        return data, self.SIGNIN
github guirem / plugin-googlecast / resources / plexapi / server.py View on Github external
def __init__(self, baseurl=None, token=None, session=None, timeout=None):
        self._baseurl = baseurl or CONFIG.get('auth.server_baseurl', 'http://localhost:32400')
        self._baseurl = self._baseurl.rstrip('/')
        self._token = logfilter.add_secret(token or CONFIG.get('auth.server_token'))
        self._showSecrets = CONFIG.get('log.show_secrets', '').lower() == 'true'
        self._session = session or requests.Session()
        self._library = None   # cached library
        self._settings = None   # cached settings
        self._myPlexAccount = None   # cached myPlexAccount
        data = self.query(self.key, timeout=timeout)
        super(PlexServer, self).__init__(self, data, self.key)
github pkkid / python-plexapi / plexapi / myplex.py View on Github external
def _signin(self, username, password, timeout):
        if self._token:
            return self.query(self.key), self.key
        username = username or CONFIG.get('auth.myplex_username')
        password = password or CONFIG.get('auth.myplex_password')
        data = self.query(self.SIGNIN, method=self._session.post, auth=(username, password), timeout=timeout)
        return data, self.SIGNIN
github Haynie-Research-and-Development / jarvis / deps / lib / python3.4 / site-packages / plexapi / myplex.py View on Github external
def _signin(self, username, password, timeout):
        if self._token:
            return self.query(self.key), self.key
        username = username or CONFIG.get('auth.myplex_username')
        password = password or CONFIG.get('auth.myplex_password')
        data = self.query(self.SIGNIN, method=self._session.post, auth=(username, password), timeout=timeout)
        return data, self.SIGNIN
github pkkid / python-plexapi / plexapi / myplex.py View on Github external
def _signin(self, username, password, timeout):
        if self._token:
            return self.query(self.key), self.key
        username = username or CONFIG.get('auth.myplex_username')
        password = password or CONFIG.get('auth.myplex_password')
        data = self.query(self.SIGNIN, method=self._session.post, auth=(username, password), timeout=timeout)
        return data, self.SIGNIN
github pkkid / python-plexapi / plexapi / server.py View on Github external
def __init__(self, baseurl=None, token=None, session=None, timeout=None):
        self._baseurl = baseurl or CONFIG.get('auth.server_baseurl', 'http://localhost:32400')
        self._baseurl = self._baseurl.rstrip('/')
        self._token = logfilter.add_secret(token or CONFIG.get('auth.server_token'))
        self._showSecrets = CONFIG.get('log.show_secrets', '').lower() == 'true'
        self._session = session or requests.Session()
        self._library = None   # cached library
        self._settings = None   # cached settings
        self._myPlexAccount = None   # cached myPlexAccount
        data = self.query(self.key, timeout=timeout)
        super(PlexServer, self).__init__(self, data, self.key)
github pkkid / python-plexapi / plexapi / client.py View on Github external
def __init__(self, server=None, data=None, initpath=None, baseurl=None,
          token=None, connect=True, session=None, timeout=None):
        super(PlexClient, self).__init__(server, data, initpath)
        self._baseurl = baseurl.strip('/') if baseurl else None
        self._token = logfilter.add_secret(token)
        self._showSecrets = CONFIG.get('log.show_secrets', '').lower() == 'true'
        server_session = server._session if server else None
        self._session = session or server_session or requests.Session()
        self._proxyThroughServer = False
        self._commandId = 0
        self._last_call = 0
        if not any([data, initpath, baseurl, token]):
            self._baseurl = CONFIG.get('auth.client_baseurl', 'http://localhost:32433')
            self._token = logfilter.add_secret(CONFIG.get('auth.client_token'))
        if connect and self._baseurl:
            self.connect(timeout=timeout)