GET /machines.json
762981
def index(params={})
      self.request_options = self.request_options.merge(params[:query] || {})
      response = Zcloudjp::Client.get("/machines", self.request_options)
      response.parsed_response.map do |res|
        update_attributes(res).clone
      end
    end
704468
def _get_json(self, model, space=None, rel_path=None, extra_params=None, get_all=None):
        
        # Only API.spaces and API.event should not provide
        # the `space argument
        if space is None and model not in (Space, Event):
            raise Exception(
                'In general, `API._get_json` should always '
                'be called with a `space` argument.'
            )

        if not extra_params:
            extra_params = {}

        # Handle pagination for requests carrying large amounts of data
        extra_params['page'] = extra_params.get('page', 1)

        # Generate the url to hit
        url = '{0}/{1}/{2}.json?{3}'.format(
            settings.API_ROOT_PATH,
            settings.API_VERSION,
            rel_path or model.rel_path,
            urllib.urlencode(extra_params),
        )

        # If the cache is being used and the url has been hit already
        if self.cache_responses and url in self.cache:
            response = self.cache[url]
        else:
            # Fetch the data
            headers = {
                'X-Api-Key': self.key,
                'X-Api-Secret': self.secret,
            }
            response = self.session.get(url=url, headers=headers)
            # If the cache is being used, update it
            if self.cache_responses:
                self.cache[url] = response

        if response.status_code == 200:  # OK
            results = []
            json_response = response.json()
            for obj in json_response:
                instance = model(data=obj)
                instance.api = self
                if space:
                    instance.space = space
                results.append(instance)
            # If it looks like there are more pages to fetch,
            # try and fetch the next one
            per_page = extra_params.get('per_page', None)
            if (
                get_all
                and per_page
                and len(json_response)
                and per_page == len(json_response)
            ):
                extra_params['page'] += 1
                results = results + self._get_json(model, space, rel_path, extra_params, get_all=get_all)
            return results
        elif response.status_code == 204:  # No Content
            return []
        else:  # Most likely a 404 Not Found
            raise Exception(
                'Code {0} returned from `{1}`. Response text: "{2}".'.format(
                    response.status_code,
                    url,
                    response.text
                )
            )
1177877
def get(self, param=None, must=[APIKEY]):
        '''
        '''
        param = {} if param is None else param
        r = self.verify_param(param, must)
        if not r.is_succ():
            return r
        handle = CommonResultHandler(lambda rsp: {VERSION_V1:rsp.get(USER), VERSION_V2:rsp}[self.version()])
        return self.path('get.json').post(param, handle, r)
1172814
def getJson(cls, url, method='GET', headers={}, data=None, socket=None, timeout=120):
        
        if not 'Content-Type' in headers:
            headers['Content-Type'] = ['application/json']

        body = yield cls().getBody(url, method, headers, data, socket, timeout)

        defer.returnValue(json.loads(body))
1167709
function getVersionRoute(machineName, versionKey) {
        let manifest = getManifest();

        if (!manifest.machines[machineName]) {
            throw new Error("Machine does not exists");
        }

        if (!manifest.machines[machineName].versions[versionKey]) {
            throw new Error("Version does not exists");
        }

        return manifest.machines[machineName].versions[versionKey].route;
    }
620653
def show(params={})
      key = params.delete(:key)
      Zcloudjp::Client.get("/machines/#{machine.id}/metadata/#{key}", machine.request_options)
    end
1361358
def metadata_index_json(self):
        """"""
        try:
            return op.join(self.metadata_dir, 'INDEX.json')
        except FileNotFoundError:
            return op.join(self.metadata_dir, 'INDEX_JSON')
1262542
def json_engine(self, req): # pylint: disable=R0201,W0613
        
        try:
            return stats.engine_data(config.engine)
        except (error.LoggableError, xmlrpc.ERRORS) as torrent_exc:
            raise exc.HTTPInternalServerError(str(torrent_exc))
266482
def treat_machine_dict(machine):
    '''
    
    '''
    machine.update({
        'id': machine.get('id', ''),
        'image': machine.get('image', ''),
        'size': '{0} MB'.format(machine.get('memorySize', 0)),
        'state': machine_get_machinestate_str(machine),
        'private_ips': [],
        'public_ips': [],
    })

    # Replaced keys
    if 'memorySize' in machine:
        del machine['memorySize']
    return machine
798432
def get(args):
    """"""
    from . import config
    for key in args.key.split("."):
        config = getattr(config, key)
    print(json.dumps(config))
921631
def _get_json(self, url):
        
        self.log.info(u"/GET " + url)
        r = requests.get(url)
        if hasattr(r, 'from_cache'):
            if r.from_cache:
                self.log.info("(from cache)")
        if r.status_code != 200:
            throw_request_err(r)

        return r.json()
715057
function getJshintrc () {
    var jshintrcPath = process.cwd() + '/.jshintrc';

    try {
        return JSON.parse(fs.readFileSync(jshintrcPath, 'utf8'));
    }
    catch (error) {
        console.warn(`Expected to find JSHint configuration ${jshintrcPath}. Using default JSHint configuration`);
        return undefined;
    }
}
351192
def get_json(url, auth=None, data=None):
    """"""
    headers = {
        'Accept': 'application/vnd.travis-ci.2+json',
        'User-Agent': 'Travis/Tox-Travis-1.0a',
        # User-Agent must start with "Travis/" in order to work
    }
    if auth:
        headers['Authorization'] = 'token {auth}'.format(auth=auth)

    params = {}
    if data:
        headers['Content-Type'] = 'application/json'
        params['data'] = json.dumps(data).encode('utf-8')

    request = urllib2.Request(url, headers=headers, **params)
    response = urllib2.urlopen(request).read()
    return json.loads(response.decode('utf-8'))
450666
function reqToJSON () {
  const {ip, method, url, headers} = this
  const userAgent = headers ? headers['user-agent'] : void (0)
  return {ip, method, url, userAgent}
}
712600
function check(err, res, body) {
    if (err) {
        return this.machine(err);
    }
    var obj;
    try {
        obj = JSON.parse(body);
    } catch (e) {
        return this.machine(new Error('Failed to parse as JSON (' + e.message + ') the text: ' + body));
    }
    if (res.statusCode !== 200) {
        return this.machine(obj);
    }
    this.machine(err, obj);
}
1289807
def get_json(url)
      r = Mei::WebServiceBase.fetch(url)
      JSON.parse(r.body)
    end
1077645
def get(args):
    
    m = TemplateManager(args.hosts)
    t = m.get(args.name)
    if t:
        print(json.dumps(t, indent=2))
    else:
        sys.exit(1)