Initial Commit
- initial default booting image
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
# Example Varlink service
|
||||
interface org.example.test
|
||||
|
||||
# Returns the same string
|
||||
method Ping(ping: string) -> (pong: string)
|
||||
@@ -0,0 +1,24 @@
|
||||
import os
|
||||
|
||||
import varlink
|
||||
|
||||
service = varlink.Service(interface_dir=os.path.dirname(__file__))
|
||||
|
||||
|
||||
class ServiceRequestHandler(varlink.RequestHandler):
|
||||
service = service
|
||||
|
||||
|
||||
@service.interface("org.example.test")
|
||||
class Example:
|
||||
def Ping(self, ping):
|
||||
return {"pong": ping}
|
||||
|
||||
|
||||
def run_server(address):
|
||||
with varlink.ThreadingServer(address, ServiceRequestHandler) as server:
|
||||
print("Listening on", server.server_address)
|
||||
server.serve_forever()
|
||||
|
||||
|
||||
run_server("unix:@test")
|
||||
Reference in New Issue
Block a user