def get_music_section(host, port, token, library_name):
 api_endpoint = append_token('library/sections', token)
 url = urljoin('http://{0}:{1}'.format(host, port), api_endpoint)
 r = requests.get(url)
 tree = ET.fromstring(r.content)
 for child in tree.findall('Directory'):
  if (child.get('title') == library_name):
   return child.get('key')

def get_music_section ( host , port , token , library_name ) : api_endpoint = append_token ( 'library/sections' , token ) url = urljoin ( 'http://{0}:{1}' . format ( host , port ) , api_endpoint ) r = requests . get ( url ) tree = ET . fromstring ( r . content ) for child in tree . findall ( 'Directory' ) : if ( child . get ( 'title' ) == library_name ) : return child . get ( 'key' )
getting the section key for the music library in plex .