Пример #1
0
    def get_updates(self):
        """
        Gets all updates relative to the authenticated user
        """
        if (not self._access_token) or (not self._access_token_secret):
            self.error = "You do not have an access token. Plase perform 'accessToken()' method first."
            raise OAuthError(self.error)

        raw_url = "/v1/people/"
        raw_url = raw_url + "~/network/updates"

        response = self._do_normal_query(raw_url)
        error = self._parse_error(response)
        if error:
            self.error = error
            return None

        from StringIO import StringIO
        content = StringIO(response)
        document = parse(content)
        updates = document.getroot()
        result = []
        for update in updates:
            update_type = update.find("update-type").text
            up = Update.create(update,update_type)
            if up is not None:
                result.append(up)

        return result