это мой код, я не знаю, почему я не могу запустить API
import kivy
from kivy.core.window import Window
from kivy.app import App
from kivy.uix.label import Label
from kivy.uix.gridlayout import GridLayout
from kivy.uix.textinput import TextInput
from kivy.properties import ListProperty
from kivy.uix.button import Button
from kivy.lang import Builder
from ipify import get_ip
import geocoder
from datetime import datetime
class MainPage(GridLayout):
# runs on initialization
def __init__(self, **kwargs):
super().__init__(**kwargs)
#used for grid
self.cols = 1
#Labels
self.IP_label = TextInput(text = " IP Address " , height = Window.size[0]*0.16)
self.Mac_address = TextInput(text = "MAC Address" , height = Window.size[0]*0.16)
self.GPS = TextInput(text = "GPS(Lat,Lon)" , height= Window.size[0]*0.16)
self.time_stamp = TextInput(text = "Time" , height = Window.size[0]*0.16)
#buttons
self.get_ip = Button(text = " Get IP " , height = Window.size[0]*0.16 , on_press = self.get_public_ip)
self.get_loc = Button(text = "get_Loc" , height = Window.size[0] , on_press = self.get_location_mac_time)
#adding widgets
self.add_widget(self.IP_label)
self.add_widget(self.Mac_address)
self.add_widget(self.GPS)
self.add_widget(self.time_stamp)
self.add_widget(self.get_ip)
self.add_widget(self.get_loc)
#functions
def get_public_ip(self,instance):
ip = get('https://ip.seeip.org').text
self.IP_label.text = 'My public IP address is: {}'.format(ip)
with open('Public_IP.txt', 'w') as k:
print('My public IP address is: {}'.format(ip) , file = k)
def get_location_mac_time(self,instance):
g = geocoder.ip('me')
Time_now = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
k= tuple(g.latlng)
my_dict = {}
for idx, val in enumerate(k):
my_dict["v{}".format(idx)] = str(val)
self.Mac_address.text = "The MAC address is : "+':'.join(re.findall('..', '%012x' % uuid.getnode()))
self.GPS.text = my_dict['v0'] + ',' + my_dict['v1']
self.time_stamp.text = "timestamp :"+ Time_now
with open('loc_mac_time.txt', 'w') as f:
print(Time_now, " ",my_dict['v0']," ",my_dict['v1']," " ,':'.join(re.findall('..', '%012x' % uuid.getnode())),file=f)
class test_app(App):
def build(self):
return MainPage()
if __name__ == "__main__":
test_app().run()
and no error to show i swear , i cant build the api i dont know why