MCPcopy
hub / github.com/pyload/pyload / callApi

Function callApi

module/web/api_app.py:68–79  ·  view source on GitHub ↗
(func, *args, **kwargs)

Source from the content-addressed store, hash-verified

66
67
68def callApi(func, *args, **kwargs):
69 if not hasattr(PYLOAD.EXTERNAL, func) or func.startswith("_"):
70 print "Invalid API call", func
71 return HTTPError(404, json.dumps("Not Found"))
72
73 result = getattr(PYLOAD, func)(*[literal_eval(x) for x in args],
74 **dict([(x, literal_eval(y)) for x, y in kwargs.iteritems()]))
75
76 # null is invalid json response
77 if result is None: result = True
78
79 return json.dumps(result, cls=TBaseEncoder)
80
81
82#post -> username, password

Callers 1

call_apiFunction · 0.85

Calls 3

HTTPErrorClass · 0.90
dictFunction · 0.85
iteritemsMethod · 0.45

Tested by

no test coverage detected