@defer.inlineCallbacks
    def _create_request(self, method, url, producer=None, headers_dict={}):
        headers_dict["User-Agent"] = ["Synapse Cmd Client"]

        retries_left = 5
        print "%s to %s with headers %s" % (method, url, headers_dict)
        if self.verbose and producer:
            if "password" in producer.data:
                temp = producer.data["password"]
                producer.data["password"] = "[REDACTED]"
                print json.dumps(producer.data, indent=4)
                producer.data["password"] = temp
            else:
                print json.dumps(producer.data, indent=4)

        while True:
            try:
                response = yield self.agent.request(
                    method,
                    url.encode("UTF8"),
                    Headers(headers_dict),
                    producer
                )
                break
            except Exception as e:
                print "uh oh: %s" % e
                if retries_left:
                    yield self.sleep(2 ** (5 - retries_left))
                    retries_left -= 1
                else:
                    raise e

        if self.verbose:
            print "Status %s %s" % (response.code, response.phrase)
            print pformat(list(response.headers.getAllRawHeaders()))
        defer.returnValue(response)
Creates and sends a request to the given url
dataset/ETHPy150Open matrix-org/synapse/contrib/cmdclient/http.py/TwistedHttpClient._create_request