示例#1
0
    def schema_by_sql(self):
        if not self._schema:
            try:
                self._load_info_by_sql()
                self._schema = schema.Schema(self._info['schema']['fields'])

            except KeyError:
                raise exceptions.InternalError(
                    'Unexpected table response: missing schema')
        return self._schema
示例#2
0
    def schema_by_response(self, response):
        if not self._schema:
            try:
                self._load_info_by_response(response)
                self._schema = schema.Schema(self._info['schema']['fields'])

            except KeyError:
                raise exceptions.InternalError(
                    'Unexpected table response: missing schema. Response content: {}'
                    .format(self._info))
        return self._schema
示例#3
0
def post(url,
         params=None,
         data=None,
         extra_headers=None,
         raw_response=False,
         stats=None):
    if data is None:
        raise exceptions.InternalError(
            'Cannot perform POST request without data')
    return _request(url,
                    METHOD_POST,
                    params=params,
                    data=data,
                    extra_headers=extra_headers,
                    raw_response=raw_response,
                    stats=stats)
示例#4
0
def post(url,
         params=None,
         data=None,
         json=None,
         extra_headers=None,
         raw_response=False,
         stats=None):
    if data is None and json is None:
        raise exceptions.InternalError(
            'Cannot perform POST request without data and json')

    return _adapter.request(_adapter.POST,
                            '',
                            params=params,
                            data=data,
                            json=json,
                            base=url,
                            extra_headers=extra_headers,
                            sec_id_for_special_token=Store.config_id,
                            raw_content=raw_response)