def _call(self, api, **fields): resp_headers = Dict.get_and_del_from_dict(fields, 'resp_headers', {}) if api.startswith('public/'): # should use GET url = self.url + api + '?' + urllib.urlencode(fields) fields = None else: # should use POST url = self.url + api headers = self._get_token_header(api) resp = httputil.curl(url, fields, headers, use_json=True, resp_headers=resp_headers) self._check_error(resp) return resp
def call_api(api, headers={}, **fields): url = 'http://%s/%s' % (settings.API_DOMAIN, api) r = httputil.curl(url, fields, headers, True) if hasattr(r, 'error'): raise CodedError(r.error, r['message']) return r
def execute(host, cmd): url = 'http://%s:8082/exec' % host resp = httputil.curl(url, {'cmd' : cmd}) return _parse_response(resp.splitlines())
def execute(host, cmd): url = 'http://%s:8082/exec' % host resp = httputil.curl(url, {'cmd': cmd}) return _parse_response(resp.splitlines())