Kivy android ModuleNotFoundError: No module named 'requests'

Viewed 34

I'm trying to run a Kivy android app that uses requests module

This is my buildozer.spec requirements and permissions:

requirements = python3,kivy,hostpython3,openssl,certifi,chardet,urllib3,idna,requests
android.permissions = INTERNET

Deploying the app, does try to open but instantly closes with this message: ModuleNotFoundError: No module named 'requests'

This is a minimal example to reproduce the situation:

import requests
from requests.auth import HTTPBasicAuth
import json
from kivy.app import App
from kivy.uix.gridlayout import GridLayout
from kivy.uix.textinput import TextInput
from kivy.uix.dropdown import DropDown
from kivy.uix.button import Button
from kivy.uix.label import Label
from kivy.uix.image import Image
from kivy.clock import Clock

class Inremapp(App):
    def build(self):
        self.userid = "Hello"
        self.pwd = "12345aaa!"
        self.window = GridLayout()
        self.window.cols = 1
        self.window.size_hint = (0.6, 0.7)
        self.window.pos_hint = {"center_x": 0.5, "center_y":0.5}

        try:
            url = "http://192.1.1.250:7048/DynamicsNAV110/ODataV4/Company('Inrema%20SL')/Control_de_horas_GET_diario"
            response = requests.get(url, auth=HTTPBasicAuth(self.userid, self.pwd), timeout=20)
            data_dict = json.loads(response.content)
            for row in data_dict["value"]:
                print(row)            
        except Exception as ex:
            print(str(ex))

            labelexample = Label(text='Example')
            self.window.add_widget(labelexample)

        return self.window

# run app
if __name__ == "__main__":
    Inremapp().run()

How can I include the requests module correctly?

0 Answers
Related