Send a request to the 46elks API.
        Fetches SMS history as JSON by default, sends a HTTP POST request
        with the incoming data dictionary as a urlencoded query if data is
        provided, otherwise HTTP GET

        Throws HTTPError on non 2xx

def query_api(self, data=None, endpoint='SMS'):
        """ Send a request to the 46elks API.
        Fetches SMS history as JSON by default, sends a HTTP POST request
        with the incoming data dictionary as a urlencoded query if data is
        provided, otherwise HTTP GET

        Throws HTTPError on non 2xx
        """
        url = self.api_url % endpoint
        if data:
            response = requests.post(
                url,
                data=data,
                auth=self.auth
            )
        else:
            response = requests.get(
                url,
                auth=self.auth
            )
        try:
            response.raise_for_status()
        except HTTPError as e:
            raise HTTPError('HTTP %s\n%s' %
                    (response.status_code, response.text))
        return response.text