-
Notifications
You must be signed in to change notification settings - Fork 1
the PythonicOS API
the PythonicOS API is a set of python scripts that allow you to connect your scripts to the main pythonicOS script.
to use the PythonicOS API you need to import the towii.py file into your script.
import towii
then you can run
from towii import pydata1,pydata2
to import the data from the towii.py file.
the towii.py file contains these variables:
'''when calling pydata1.send() it will send the data to pydata2.recv() and vice versa, there is a total of 100 pydata sockets you can send data to and from'''
pydata1, pydata2 = socket.socketpair()
'''when calling time from time2 you will recive the system time in UNIX format'''
time1, time2 = socket.socketpair()
'''with the wait socket, you can use it like a normal socket to send data too and from, but you can also use it to halt any program with a certain header'''
wait1, wait2 = socket.socketpair()
'''the start socket is used to start any program with a certain header'''
start1, start2 = socket.socketpair()
'''the stop socket is used to stop any program with a certain header'''
stop1, stop2 = socket.socketpair()
'''the cont socket is used to continue any program with a certain header'''
cont1,cont2 = socket.socketpair()
'''the halt socket is used to halt any program with a certain header'''
halt1, halt2 = socket.socketpair()
you can send data over the socket by using the pydata1.saend() function or a similar function for the socket your using.
pydata1.send("hello world")
then on the reciving end you can use the pydata2.recv() function or a similar function for the socket your using.
pydata2.recv(1024)
you can also use the time socket to get the system time in UNIX format.
import time
time = time.time()
time1.send(time)
then on the reciving end you can use the time2.recv() function or a similar function for the socket your using.
time2.recv(1024)
you can also use the wait socket to halt any program with a certain header.
wait1.send("halt")
then on the reciving end you can use the wait2.recv() function or a similar function for the socket your using.
wait2.recv(1024)
you can also use the start socket to start any program with a certain header.
start1.send("start" program)
then on the reciving end you can use the start2.recv() function or a similar function for the socket your using.
start2.recv(1024)
subprocess.Popen(program)
you can also use the stop socket to stop any program with a certain header.
stop1.send("stop" program)
then on the reciving end you can use the stop2.recv() function or a similar function for the socket your using.
stop2.recv(1024)
os.kill(program)
you can also use the cont socket to continue any program with a certain header.
cont1.send("cont" program)
then on the reciving end you can use the cont2.recv() function or a similar function for the socket your using.
cont2.recv(1024)
os.cont(program)
you can also use the halt socket to halt any program with a certain header.
halt1.send("halt" program)
then on the reciving end you can use the halt2.recv() function or a similar function for the socket your using.
halt2.recv(1024)
os.halt(program)
just import Towii and call any function you want to use.
import towii
from towii import pydata1,pydata2
pydata1.send("hello world")
print(pydata2.recv(1024).decode())
just import Towii and call any function you want to use.
import towii
from towii import pydata1,pydata2,wait1,wait2,start1,start2,stop1,stop2,cont1,cont2,halt1,halt2
Def main():
print(pydata2.recv(1024).decode())
def wait():
wait1.send("halt")
if wait == "halt":
print("halted")
sleep()
just import Towii and call any function you want to use.
import towii
from towii import pydata1,pydata2,wait1,wait2,start1,start2,stop1,stop2,cont1,cont2,halt1,halt2
def main():
pydata1.send("hey! how are you?")
print(pydata2.recv(1024).decode())
when sending the command ("hey! how are you?") to the PythonicOS API, the PythonicOS API will respond with ("i'm good, how are you?") that means that the PythonicOS API is working correctly and a sickessful connection has been made.
the available commands are:
import towii
pydata1.send("hey! how are you?")
pydata1.send("what is your connection speed")
pydata1.send("what can you do?")
pydata1.send("what is your name?")
pydata1.send("what is your version?")
pydata1.send("what is your status?")
pydata1.send("what is your uptime?")
pydata1.send("what is your CPU usage?")
pydata1.send("what is your RAM usage?")
pydata1.send("what is your storage usage?")
pydata1.send("what is your GPU usage?")
pydata1.send("i have to go.")
pydata1.send("what is your IP address?")
pydata1.send("what is your MAC address?")
pydata1.send("what is your CPU model?")
pydata1.send("what is your CPU speed?")
pydata1.send("what is your CPU cores?")
pydata1.send("what is your CPU threads?")
pydata1.send("what is your CPU architecture?")
pydata1.send("what is your CPU cache?")
pydata1.send("what is your CPU temperature?")
pydata1.send("what is your RAM model?")
pydata1.send("what is your RAM speed?")
pydata1.send("what is your RAM size?")
pydata1.send("what is your RAM type?")
pydata1.send("what is your RAM voltage?")
pydata1.send("what is your RAM temperature?")
pydata1.send("what is your storage model?")
pydata1.send("what is your storage size?")
pydata1.send("what is your storage type?")
pydata1.send("what is your storage temperature?")
pydata1.send("what is your GPU model?")
pydata1.send("what is your GPU speed?")
pydata1.send("what is your GPU size?")
pydata1.send("what is your GPU type?")
pydata1.send("what is your GPU voltage?")
pydata1.send("what is your GPU temperature?")
pydata1.send("what is your GPU fan speed?")