def execute_get(self, resource, **kwargs):
        """
        Execute an HTTP GET request against the API endpoints.
        This method is meant for internal use.

        :param resource: The last part of the URI
        :param kwargs: Additional query parameters (and optionally headers)
        :return: The HTTP response as JSON or `GhostException` if unsuccessful
        """

        url = '%s/%s' % (self.base_url, resource)

        headers = kwargs.pop('headers', dict())

        headers['Accept'] = 'application/json'
        headers['Content-Type'] = 'application/json'

        if kwargs:
            separator = '&' if '?' in url else '?'

            for key, value in kwargs.items():
                if hasattr(value, '__iter__') and type(value) not in six.string_types:
                    url = '%s%s%s=%s' % (url, separator, key, ','.join(value))

                else:
                    url = '%s%s%s=%s' % (url, separator, key, value)

                separator = '&'

        if self._access_token:
            headers['Authorization'] = 'Bearer %s' % self._access_token

        else:
            separator = '&' if '?' in url else '?'
            url = '%s%sclient_id=%s&client_secret=%s' % (
                url, separator, self._client_id, self._client_secret
            )

        response = requests.get(url, headers=headers)

        if response.status_code // 100 != 2:
            raise GhostException(response.status_code, response.json().get('errors', []))

        return response.json()
def execute_get ( self , resource , ** kwargs ) : url = '%s/%s' % ( self . base_url , resource ) headers = kwargs . pop ( 'headers' , dict ( ) ) headers [ 'Accept' ] = 'application/json' headers [ 'Content-Type' ] = 'application/json' if kwargs : separator = '&' if '?' in url else '?' for key , value in kwargs . items ( ) : if hasattr ( value , '__iter__' ) and type ( value ) not in six . string_types : url = '%s%s%s=%s' % ( url , separator , key , ',' . join ( value ) ) else : url = '%s%s%s=%s' % ( url , separator , key , value ) separator = '&' if self . _access_token : headers [ 'Authorization' ] = 'Bearer %s' % self . _access_token else : separator = '&' if '?' in url else '?' url = '%s%sclient_id=%s&client_secret=%s' % ( url , separator , self . _client_id , self . _client_secret ) response = requests . get ( url , headers = headers ) if response . status_code // 100 != 2 : raise GhostException ( response . status_code , response . json ( ) . get ( 'errors' , [ ] ) ) return response . json ( )
Execute an HTTP GET request against the API endpoints.
        This method is meant for internal use.

        :param resource: The last part of the URI
        :param kwargs: Additional query parameters (and optionally headers)
        :return: The HTTP response as JSON or `GhostException` if unsuccessful