2016-01-11, 01:30
Hi All,
I dont know if this has been asked before but searching just seems to open an ocean of unrelated posts
I've fairly new to addon development but i've run into an issue and im not sure whether its a bug or im just doing something wrong
In my app i've defined a function to handle my http calls, and in the addon settings i've provided options to enter a username / password combo
basically the username / password are used to form the url eg. http://username:[email protected]/... this is all done within the http function
def http_get(querystring={}):
qs = urllib.urlencode(querystring)
url = httpScheme+"://"+gui.setting("username")+":"+gui.setting("password")+"@"+ hostname + localpath + qs
rs = requests.get(url)
if rs.status_code != 200:
dia = xbmcgui.Dialog()
dia.ok("Content Unavailable","Server returned status " + str(rs.status_code), status_to_string(rs.status_code),url)
return ""
html = rs.content
return html
So for the majority of calls this function works fine, but one particular call causes the settings to return empty like http://:@domain.com/.. which throws an error
FYI gui.setting is my file.function for getting settings
As you can see, the http calls and settings are always called in exactly the same way, yet one function causes the settings to return empty, theres nothing unusual about the function and its in the same .py as other routines that call the http function without issue
Ideas anyone?
Thanks in advance
I dont know if this has been asked before but searching just seems to open an ocean of unrelated posts
I've fairly new to addon development but i've run into an issue and im not sure whether its a bug or im just doing something wrong
In my app i've defined a function to handle my http calls, and in the addon settings i've provided options to enter a username / password combo
basically the username / password are used to form the url eg. http://username:[email protected]/... this is all done within the http function
def http_get(querystring={}):
qs = urllib.urlencode(querystring)
url = httpScheme+"://"+gui.setting("username")+":"+gui.setting("password")+"@"+ hostname + localpath + qs
rs = requests.get(url)
if rs.status_code != 200:
dia = xbmcgui.Dialog()
dia.ok("Content Unavailable","Server returned status " + str(rs.status_code), status_to_string(rs.status_code),url)
return ""
html = rs.content
return html
So for the majority of calls this function works fine, but one particular call causes the settings to return empty like http://:@domain.com/.. which throws an error
FYI gui.setting is my file.function for getting settings
As you can see, the http calls and settings are always called in exactly the same way, yet one function causes the settings to return empty, theres nothing unusual about the function and its in the same .py as other routines that call the http function without issue
Ideas anyone?
Thanks in advance