I’m working on a Kodi addon where I need to do a couple of requests to servers. The addon was initially a python script, before I decided to make it into a Kodi app and it is 100% functional using urllib3 and requests.
However, now that I’m making it into a Kodi addon it appears that I can’t import ‘urlencode’ which is a dynamically moved attribute in urllib3. If this sounds vague to you, that’s because this is vague to me too and I know no other way to describe it. I’ve added a picture below with the error for clarification. Also don’t mind the project name since I’ve used the hello world template :’)
Can anyone here help me figure this out?
url so the post doesn’t get cluttered:
https://gyazo.com/f7a5a6633f1231d8629a6d64c0af2a62
error:
Code:
import xbmcaddon
import xbmcgui
import time
import json
import datetime
import ast
import urllib
import pytz
import requests #<-- Error occurs here
import urllib3 #<-- and here
addon = xbmcaddon.Addon()
addonname = addon.getAddonInfo('name')
OldServerIP = "xxx"
#ServerIP = "xxx"
ServerIP = "xxx"
DomainName = "xxx"
2nd snippet where the function is called
http = urllib3.PoolManager()
r = http.request('GET', address, preload_content=False)
if r.status == 200:
for chunk in r.stream(): #Let's collect all the data. They usually sends out 1 url in the response.
GameURL = chunk