def _perform_request(self, request_type, resource, **kwargs):
        request_type_methods = set(["get", "post", "put", "delete"])
        if request_type not in request_type_methods:
            raise Exception("Unknown request type. Supported request types are"
                            ": {0}".format(", ".join(request_type_methods)))

        uri = "{0}{1}{2}".format(self.uri_prefix, self.domain, resource)

        # set a timeout, just to be safe
        kwargs["timeout"] = self.timeout

        response = getattr(self.session, request_type)(uri, **kwargs)

        # handle errors
        if response.status_code not in (200, 202):
            _raise_for_status(response)

        # when responses have no content body (ie. delete, set_permission),
        # simply return the whole response
        if not response.text:
            return response

        # for other request types, return most useful data
        content_type = response.headers.get('content-type').strip().lower()
        if re.match(r'application\/json;\s*charset=utf-8', content_type):
            return response.json()
        elif re.match(r'text\/csv;\s*charset=utf-8', content_type):
            csv_stream = StringIO(response.text)
            return [line for line in csv.reader(csv_stream)]
        elif re.match(r'application\/rdf\+xml;\s*charset=utf-8', content_type):
            return response.content
        elif re.match(r'text\/plain;\s*charset=utf-8', content_type):
            try:
                return json.loads(response.text)
            except ValueError:
                return response.text
        else:
            raise Exception("Unknown response format: {0}"
                            .format(content_type))
Utility method that performs all requests.
dataset/ETHPy150Open xmunoz/sodapy/sodapy/__init__.py/Socrata._perform_request