eaapi/eaapi/server/demo/tapper-test.py

33 lines
957 B
Python

from .proxy import EAMProxyServer
from ..model import ModelMatcher
server = EAMProxyServer(
upstream="http://127.0.0.1:8083",
public_url="http://127.0.0.1:5000",
verbose_errors=True
)
@server.tap("game", "sv4_save_m", matcher=ModelMatcher("KFC"), service="local2")
def sv4_save_m(ctx_in, ctx_out):
print("SAVE M")
print(ctx_in.call)
print(ctx_out.response)
game = ctx_in.call.xpath("game")
print("mid:", game.xpath("music_id").value)
print("score:", game.xpath("score").value)
print("clear:", game.xpath("clear_type").value)
just = game.xpath("just_checker")
print(
just.xpath("before_3").value, just.xpath("before_2").value, just.xpath("before_1").value,
just.xpath("just").value,
just.xpath("after_1").value, just.xpath("after_2").value, just.xpath("after_3").value
)
if __name__ == "__main__":
server.run("0.0.0.0", 5000, debug=True)