def __init__(self, url="http://localhost:5984", usePYCurl=False, ckey=None, cert=None, capath=None):
     """
     Initialise requests
     """
     JSONRequests.__init__(
         self, url, {"cachepath": None, "pycurl": usePYCurl, "key": ckey, "cert": cert, "capath": capath}
     )
     self.accept_type = "application/json"
     self["timeout"] = 600
    def makeRequest(
        self,
        uri=None,
        data=None,
        type="GET",
        incoming_headers={},
        encode=True,
        decode=True,
        contentType=None,
        cache=False,
    ):
        """
        Make the request, handle any failed status, return just the data (for
        compatibility). By default do not cache the response.

        TODO: set caching in the calling methods.
        """
        try:
            if not cache:
                incoming_headers.update({"Cache-Control": "no-cache"})
            result, status, reason, cached = JSONRequests.makeRequest(
                self, uri, data, type, incoming_headers, encode, decode, contentType
            )
        except HTTPException, e:
            self.checkForCouchError(getattr(e, "status", None), getattr(e, "reason", None), data)
 def __init__(self,
              url='http://localhost:5984',
              usePYCurl=False,
              ckey=None,
              cert=None,
              capath=None):
     """
     Initialise requests
     """
     JSONRequests.__init__(
         self, url, {
             "cachepath": None,
             "pycurl": usePYCurl,
             "key": ckey,
             "cert": cert,
             "capath": capath
         })
     self.accept_type = "application/json"
     self["timeout"] = 600
    def makeRequest(self,
                    uri=None,
                    data=None,
                    type='GET',
                    incoming_headers={},
                    encode=True,
                    decode=True,
                    contentType=None,
                    cache=False):
        """
        Make the request, handle any failed status, return just the data (for
        compatibility). By default do not cache the response.

        TODO: set caching in the calling methods.
        """
        try:
            if not cache:
                incoming_headers.update({'Cache-Control': 'no-cache'})
            result, status, reason, cached = JSONRequests.makeRequest(
                self, uri, data, type, incoming_headers, encode, decode,
                contentType)
        except HTTPException, e:
            self.checkForCouchError(getattr(e, "status", None),
                                    getattr(e, "reason", None), data)