Spaces:
Runtime error
Runtime error
File size: 431 Bytes
1c60c6e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
import re
from flask import requests
def send_command(command, location=None):
url = f"http://url/{command}"
data = {}
if location:
data["location"] = location
response = requests.post(url, json=data)
return response.content
def parse_command(text):
tokens = re.split(' \t|\n|: ', text.lower())
print(tokens)
if len(tokens) >= 2:
return tokens[1]
else:
return 'none'
|