happy/heroku.py
def api_request(self, method, endpoint, data=None, *args, **kwargs):
        """Sends an API request to Heroku.

        :param method: HTTP method.
        :param endpoint: API endpoint, e.g. ``/apps``.
        :param data: A dict sent as JSON in the body of the request.
        :returns: A dict represntation of the JSON response.
        """
        session = self._get_session()

        api_root = 'https://api.heroku.com'
        url = api_root + endpoint

        if data:
            data = json.dumps(data)

        response = session.request(method, url, data=data, *args, **kwargs)

        if not response.ok:
            try:
                message = response.json().get('message')
            except ValueError:
                message = response.content

            raise APIError(message)

        return response.json()
def api_request(self, method, endpoint, data=None, *args, **kwargs):
        session = self._get_session()

        api_root = 'https://api.heroku.com'
        url = api_root + endpoint

        if data:
            data = json.dumps(data)

        response = session.request(method, url, data=data, *args, **kwargs)

        if not response.ok:
            try:
                message = response.json().get('message')
            except ValueError:
                message = response.content

            raise APIError(message)

        return response.json()
def api_request ( self , method , endpoint , data = None , * args , * * kwargs ) : session = self . _get_session ( ) api_root = 'https://api.heroku.com' url = api_root + endpoint if data : data = json . dumps ( data ) response = session . request ( method , url , data = data , * args , * * kwargs ) if not response . ok : try : message = response . json ( ) . get ( 'message' ) except ValueError : message = response . content raise APIError ( message ) return response . json ( )
Sends an API request to Heroku.

        :param method: HTTP method.
        :param endpoint: API endpoint, e.g. ``/apps``.
        :param data: A dict sent as JSON in the body of the request.
        :returns: A dict represntation of the JSON response.
Sends an API request to Heroku .