Skip to content

Instantly share code, notes, and snippets.

@timshen91
Created August 12, 2017 06:41
Show Gist options
  • Save timshen91/b0aa69e311ea3546ebc772c091b571fd to your computer and use it in GitHub Desktop.
Save timshen91/b0aa69e311ea3546ebc772c091b571fd to your computer and use it in GitHub Desktop.
StarCraftII Repl
#!/usr/bin/python3
import websocket
from s2clientprotocol import sc2api_pb2
from google.protobuf import text_format
conn = websocket.create_connection("ws://127.0.0.1:9999/sc2api")
try:
while True:
conn.send(text_format.Parse(input(), sc2api_pb2.Request()).SerializeToString())
resp = sc2api_pb2.Response()
resp.ParseFromString(conn.recv())
print(resp)
except KeyboardInterrupt:
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment