def fetch(self, path, query='', postdata=None):
    "Perform an HTTP GET or POST depending on whether postdata is present"
    url = self.build_url(path, query=query)
    self.logger.debug("URL: %s" % url)
    try:
      if postdata is not None:
          if isinstance(postdata, dict):
              postdata = urlencode(postdata)
              self.logger.debug("postdata: %s" % postdata)
          response = self.http_post(url, postdata)
      else:
        response = self.http_get(url)
      body = response.read()
      self._debug_headers(response.headers)
      self._debug_body(body, response.headers)
      return (None, body)
    except __HOLE__, e:
      if e.code == 401:
          raise
      body = e.fp.read()
      self._debug_headers(e.headers)
      self._debug_body(body, e.headers)
      return (e, body)
dataset/ETHPy150Open versionone/VersionOne.SDK.Python/v1pysdk/client.py/V1Server.fetch