Kodi Community Forum

Full Version: Python3 url with vaules print me + instead of %20 (space)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
hi i try to make a little plugin to get stalker portals working

it reads the streamadress from a file (cachefile)
as example 
"cmd":"ffmpeg http://localhost/ch/162691_

the code is this

def retrive_defaultUrl(url, channel, tmp):

    if tmp == '0':
        s = channel.split('');
        url = s[0];
        if len(s)>1:
            url = s[1];
        return url;

    cmd = channel;


    info = retrieveData(url, values = {
        'type' : 'itv', 
        'action' : 'create_link', 
        'cmd' : channel});
    cmd = info['js']['cmd'];
    s = cmd.split(' ');
    url = s[0];
    if len(s)>1:
        url = s[1];

the result is :

but this + sign between ffmpeg and http should be %20 for space

so how i can change the + to %20
it also create the link to play the stream


so all works correct only the + sing is the problem

error i got
"list index out of range"
Use urllib quote to translate the path:

from urllib.parse import quote

url = quote(your_url)