MCPcopy Index your code
hub / github.com/tinode/chat / handle_ctrl

Function handle_ctrl

tn-cli/client.py:22–38  ·  view source on GitHub ↗
(ctrl)

Source from the content-addressed store, hash-verified

20
21# Handle {ctrl} server response
22def handle_ctrl(ctrl):
23 # Run code on command completion
24 func = tn_globals.OnCompletion.get(ctrl.id)
25 if func:
26 del tn_globals.OnCompletion[ctrl.id]
27 if ctrl.code >= 200 and ctrl.code < 400:
28 func(ctrl.params)
29
30 if tn_globals.WaitingFor and tn_globals.WaitingFor.await_id == ctrl.id:
31 if 'varname' in tn_globals.WaitingFor:
32 tn_globals.Variables[tn_globals.WaitingFor.varname] = ctrl
33 if tn_globals.WaitingFor.failOnError and ctrl.code >= 400:
34 raise Exception(str(ctrl.code) + " " + ctrl.text)
35 tn_globals.WaitingFor = None
36
37 topic = " (" + str(ctrl.topic) + ")" if ctrl.topic else ""
38 stdoutln("\r<= " + str(ctrl.code) + " " + ctrl.text + topic)
39
40
41# Lambda for handling login

Callers 2

uploadFunction · 0.90
runFunction · 0.85

Calls 2

stdoutlnFunction · 0.90
getMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…