If you have not already, we suggest setting your Plex username to something else rather than email which is displayed on your posts in forum. You can change the username at https://app.plex.tv/desktop#!/account
Welcome to our forums! Please take a few moments to read through our Community Guidelines (also conveniently linked in the header at the top of each page). There, you'll find guidelines on conduct, tips on getting the help you may be searching for, and more!

XML ... def ElementFromURL FORCE version 1 of the framework ?

I am trying to add an ADDITIONAL header to the URL request (for authentication)

I call:

Mypage = XML.ElementFromURL(url, True, None, {'Authorization': 'Basic bm10Om5tdA=='})


File ".../__init__.py", line 320, in ZDF

ZDFpage = XML.ElementFromURL(url, True, None, {'Authorization': 'Basic bm10Om5tdA=='})

TypeError: ElementFromURL() takes at most 2 arguments (4 given)

Q1: Why the exception ? What do I do wrong?

Q2: The encoding DEFAULT value in the def "utf8" ... should that not be "utf-8" ?

Here is the DEF as shown in the XML.py file (version 1)

def ElementFromURL(url, isHTML=False, values=None, headers={}, cacheTime=None, encoding="utf8", errors="strict"):

Looking at the VERSION 0 of the XML file, I see this DEF:

def ElementFromURL(url, use_html_parser=False):

ANSWER for Q1 ==> apparently I use VERSION 0 of the framework ==> How do I force to use VERSION 1 ?


  • jamjam Plex Dev Team Posts: 4,303Members, Plex Employee, Plex Pass, Plex Ninja Plex Employee
    You need to add the PlexFrameworkVersion key to the Info.plist file & set its value to 1:


    That will cause the media server to start the plug-in using the v1 framework instead of v0. Be warned that there have been many changes to the operation of plug-ins, so you'll probably have to change your existing code to work with v1. If you need any help with it, please post again!

    Regarding the encoding, Python treats "utf8" and "utf-8" the same :)
  • rniornio Posts: 162Members
    edited April 2009
    Thanks for the feedback, now I have changed the "Info.plist file" within my plug-in bundle.

    Now when I run my plug-in I get stuck here :

    # Attempt to import the plug-in module - if debugging is enabled, don't catch exceptions
      if Debug:
    	PMS.Log("(Framework) Next Step 1")
    	import Code as _plugin
    	PMS.Log("(Framework) Next Step 2")
    	PMS.Log("(Framework) Imported plug-in module")

    The plug-in log:

    (Framework) Bundle verification complete
    (Framework) Debugging is enabled
    (Framework) Configured framework modules
    (Framework) Next Step 1

    Looking inside the Plugin.py ... I do not see "Code" being initialized?

    Any clues?

    Is there a PLUG-IN which uses Version 1 of the framework?
  • elanelan CTO and Co-founder MauiPosts: 9,846Members, Plex Employee, Plex Pass, Plex Ninja Plex Employee
    rnio wrote on Apr 25 2009, 10:24 AM:
    Any clues?

    Is there a PLUG-IN which uses Version 1 of the framework?

    There have been quite a few changes to v1 to make things cleaner and easier. You can check Vimeo, Democracy Now, Charlie Rose, The New York Times, and The Sixty One, to name a few.

    Good documentation is being worked on as we speak :)

    instagram @elan // the wife's photography site.
    the Medium page // the dog's twitter feed.

Sign In or Register to comment.