@nylas_excepted
    def _create_resource(self, cls, data, **kwargs):
        url = "{}/{}/".format(self.api_server, cls.collection_name)

        if len(kwargs.keys()) > 0:
            url = "{}?{}".format(url, urlencode(kwargs))

        session = self._get_http_session(cls.api_root)

        if cls == File:
            response = session.post(url, files=data)
        else:
            data = json.dumps(data)
            headers = {'Content-Type': 'application/json'}
            headers.update(self.session.headers)
            response = session.post(url, data=data, headers=headers)

        result = _validate(response).json()
        if cls.collection_name == 'send':
            return result
        return cls.create(self, **result)
dataset/ETHPy150Open nylas/nylas-python/nylas/client/client.py/APIClient._create_resource/original