from kivy.uix.boxlayout import BoxLayoutimport requests, json, urllib3urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
class SignupPage(BoxLayout): def signup(self): username, password = self.ids.username.text, self.ids.password.text info = { "signup": [ { "username": username, "password": password } ] }
# headers = {"Content-type": "application/json"} resp = requests.post(url, data=dict(info=json.dumps(info)), verify=False) if resp: if username and password: print('Data successfully saved!') else: print('Please enter user name and password!')
<SignupPage>: orientation: 'vertical' Label: text: 'Welcome to tima SignUp page' font_size: 30
GridLayout: orientation: 'vertical' cols: 2 padding: 5 spacing: 5 row_force_default: True row_default_height: 40 size_hint_x: 1 size_hint_y: 1 Label: text: 'User Name:' size_hint_x: None width: 100 TextInput: id: username multiline: False Label: text: 'Password' size_hint_x: None width: 100 TextInput: id: password multiline: False password: True # hide password Label: text: '' size_hint_x: None width: 100 Button: text: "SignUp" size_hint_x: None width: 100 on_release: root.signup()
from kivy.app import Appfrom kivy.uix.boxlayout import BoxLayoutfrom kivy.uix.screenmanager import ScreenManager, Screenfrom kivy.lang.builder import Builderfrom signup.signup import SignupPage
Builder.load_file('signup/signup.kv')
class RootWidget(BoxLayout): pass
class MainApp(App): def build(self): return SignupPage()
if __name__ == '__main__': MainApp().run()
BoxLayout: size_hint: .5,.5 pos: 200,200 name: "user" Button: text: "back" on_release: app.root.current = "login_page"
Have you added internet permissions for android in your requirements? You will also need openssl as it's a HTTPS request....
requirements = kivy,requests,openssl,urllib3,futures,kivymd