当前位置: 首页>>代码示例>>Python>>正文


Python httplib.NO_CONTENT属性代码示例

本文整理汇总了Python中httplib.NO_CONTENT属性的典型用法代码示例。如果您正苦于以下问题:Python httplib.NO_CONTENT属性的具体用法?Python httplib.NO_CONTENT怎么用?Python httplib.NO_CONTENT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在httplib的用法示例。


在下文中一共展示了httplib.NO_CONTENT属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: send

# 需要导入模块: import httplib [as 别名]
# 或者: from httplib import NO_CONTENT [as 别名]
def send(self, request):
        url = self.__get_request_url_for_urllib(request)
        msg = request.message
        headers = request.headers
        try:
            u2request = urllib2.Request(url, msg, headers)
            self.addcookies(u2request)
            self.proxy = self.options.proxy
            request.headers.update(u2request.headers)
            log.debug('sending:\n%s', request)
            fp = self.u2open(u2request, timeout=request.timeout)
            self.getcookies(fp, u2request)
            headers = fp.headers
            if sys.version_info < (3, 0):
                headers = headers.dict
            reply = Reply(httplib.OK, headers, fp.read())
            log.debug('received:\n%s', reply)
            return reply
        except urllib2.HTTPError as e:
            if e.code not in (httplib.ACCEPTED, httplib.NO_CONTENT):
                raise TransportError(e.msg, e.code, e.fp) 
开发者ID:suds-community,项目名称:suds,代码行数:23,代码来源:http.py

示例2: _response

# 需要导入模块: import httplib [as 别名]
# 或者: from httplib import NO_CONTENT [as 别名]
def _response(self, step_name, data, size, status_code, error_body):
    step_data = [
        self.m.json.output({
          'status_code': status_code,
          'success': status_code in (httplib.OK, httplib.NO_CONTENT),
          'size': size,
          'error_body': error_body,
        }, name='status_json'),
    ]
    if data:
      step_data.append(data)
    return self.step_data(step_name, *step_data) 
开发者ID:luci,项目名称:recipes-py,代码行数:14,代码来源:test_api.py

示例3: _handle_server_response

# 需要导入模块: import httplib [as 别名]
# 或者: from httplib import NO_CONTENT [as 别名]
def _handle_server_response(self, response):

        if response.status in (httplib.OK, httplib.CREATED,
                               httplib.NO_CONTENT):
            return response

        logger.debug('invalid response status:{st} body:{body}'.format(
                     st=response.status, body=response.data))

        EtcdError.handle(response) 
开发者ID:bsc-s2,项目名称:pykit,代码行数:12,代码来源:client.py

示例4: _do_request

# 需要导入模块: import httplib [as 别名]
# 或者: from httplib import NO_CONTENT [as 别名]
def _do_request(address, path):
    conn = httplib.HTTPConnection(address)
    conn.request('GET', path)
    res = conn.getresponse()
    if res.status in (httplib.OK,
                      httplib.CREATED,
                      httplib.ACCEPTED,
                      httplib.NO_CONTENT):
        return res

    raise httplib.HTTPException(
        res, 'code %d reason %s' % (res.status, res.reason),
        res.getheaders(), res.read()) 
开发者ID:OpenState-SDN,项目名称:ryu,代码行数:15,代码来源:proxy.py

示例5: _handle_delete

# 需要导入模块: import httplib [as 别名]
# 或者: from httplib import NO_CONTENT [as 别名]
def _handle_delete(gcs_stub, filename):
  """Handle DELETE object."""
  if gcs_stub.delete_object(filename):
    return _FakeUrlFetchResult(httplib.NO_CONTENT, {}, '')
  else:
    return _FakeUrlFetchResult(httplib.NOT_FOUND, {}, '') 
开发者ID:GoogleCloudPlatform,项目名称:python-compat-runtime,代码行数:8,代码来源:stub_dispatcher.py


注:本文中的httplib.NO_CONTENT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。