Request Library Import Issue

  Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
NeoNator Offline
Junior Member
Posts: 9
Joined: Apr 2017
Reputation: 0
Post: #1
Hi

Im attempting to use some JSON commands in a kodi app im playing with but most examples use the requests library. But if i try to import the library ("import requests") it breaks my code.. So i think ive just missed something important somewhere could someone point me in the right direction for getting this working?

Thanks! Big Grin
find quote
MetalChris Offline
Fan
Posts: 659
Joined: Jan 2014
Reputation: 34
Location: U.S.A.
Post: #2
Is the requests module installed on your system? If not: script.module.requests-2.12.4.zip

XBMC Gotham (13.2) on ThinkPad T400 Ubuntu 12.04.5 | Kodi Jarvis (16.1) on HTPC Lubuntu 14.04 | My Add-ons | My Repo
find quote
Lunatixz Offline
Skilled Python Coder
Posts: 4,899
Joined: May 2011
Reputation: 142
Location: NYC
Post: #3
If you are trying to access a json response from a local Kodi instance use Kodi's API, request modules only needed to access LAN response.

https://codedocs.xyz/xbmc/xbmc/group__py...9ed84ed846

Sent from my SM-G935T (typie typie)
(This post was last modified: 2017-05-13 05:07 by Lunatixz.)
find quote
NeoNator Offline
Junior Member
Posts: 9
Joined: Apr 2017
Reputation: 0
Post: #4
Thanks for the responses!

(2017-05-13 04:24)MetalChris Wrote:  Is the requests module installed on your system? If not: script.module.requests-2.12.4.zip

See i thought it should be installed as it is listed here "http://kodi.wiki/view/Category:Add-on_libraries/modules" how do i check if its installed?

(2017-05-13 04:24)MetalChris Wrote:  If not: script.module.requests-2.12.4.zip

And if i find its not installed how do i go about installing this? Sorry im real noob with this kodi stuff Tongue

(2017-05-13 05:07)Lunatixz Wrote:  If you are trying to access a json response from a local Kodi instance use Kodi's API, request modules only needed to access LAN response.

https://codedocs.xyz/xbmc/xbmc/group__py...9ed84ed846

Sent from my SM-G935T (typie typie)

Yep i am trying to access LAN response, not local Sad
find quote
NeoNator Offline
Junior Member
Posts: 9
Joined: Apr 2017
Reputation: 0
Post: #5
Ok so after a bit more searching i found this thread:

http://forum.kodi.tv/showthread.php?tid=263922

in which sounds like someone having the same issue as me. So after following this i added into script.module.requests-2.12.4 into \Kodi\addons

script.module.requests

added to addon.xml

<import addon="script.module.requests" version="2.12.4"/>

in addon.py

import requests


but i still get an error Sad am i putting the lib in the correct spot? In the kodi addon settings i've allowed from unknown sources, is there something else i should be doing?
find quote
MetalChris Offline
Fan
Posts: 659
Joined: Jan 2014
Reputation: 34
Location: U.S.A.
Post: #6
(2017-05-13 12:48)NeoNator Wrote:  So after following this i added into script.module.requests-2.12.4 into \Kodi\addons

You can no longer simply drop a folder into the addons directory. You'll need to install from zip.

XBMC Gotham (13.2) on ThinkPad T400 Ubuntu 12.04.5 | Kodi Jarvis (16.1) on HTPC Lubuntu 14.04 | My Add-ons | My Repo
find quote
NeoNator Offline
Junior Member
Posts: 9
Joined: Apr 2017
Reputation: 0
Post: #7
That was it! thanks mate really appreciate it!!!
find quote
MetalChris Offline
Fan
Posts: 659
Joined: Jan 2014
Reputation: 34
Location: U.S.A.
Post: #8
Excellent! Keep us posted with your progress.

XBMC Gotham (13.2) on ThinkPad T400 Ubuntu 12.04.5 | Kodi Jarvis (16.1) on HTPC Lubuntu 14.04 | My Add-ons | My Repo
find quote