Skip to content

Instantly share code, notes, and snippets.

Last active April 5, 2018 11:07
What would you like to do?
from time import sleep
from requests import post
import webbrowser
id = '...'
pw = '...'
def run(timeout=60):
print('[*] Start Bot', id)
while True:
for task in get_task():
print('[*] run task', task['id'])
result = globals()[task['cmd']]()
send_result(task['id'], result)
print(' OKAY')
except Exception as e:
print(' ERROR')
send_result(task['id'], 'ERROR: '+str(e))
print('[*] sleep...')
for i in range(timeout):
def get_task():
payload = {'id': id, 'pw': pw}
r = post('', data=payload)
return r.json()
def send_result(task_id, result):
payload = {'id': id, 'task': task_id, 'result': result}
r = post('', data=payload)
def hello():
return 'Hello I''m'+id
def opensr():
url = ''
return 'open '+url
if __name__ == '__main__':
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment