예제 #1
0
    def follow_user(self, user, delegate):
        """Follow the given user.

        Returns the user info back to the given delegate
        """
        parser = txml.Users(delegate)
        return self.__postPage('/friendships/create/%s.xml' % (user, ), parser)
예제 #2
0
    def report_spam(self, user_id, delegate):
        """Report an user for spam

        'delegate' should a function that will get the user info returned by the API.

        Returns a deferred for the API call.
        """
        parser = txml.Users(delegate)
        return self.__postPage('/report_spam.xml', parser,
                               {'user_id': str(user_id)})
예제 #3
0
    def show_user(self, user):
        """Get the info for a specific user.

        Returns a delegate that will receive the user in a callback."""

        url = '/users/show/%s.xml' % (user, )
        d = defer.Deferred()

        self.__downloadPage(url, txml.Users(lambda u: d.callback(u))) \
            .addErrback(lambda e: d.errback(e))

        return d
예제 #4
0
 def verify_credentials(self, delegate=None):
     "Verify a user's credentials."
     parser = txml.Users(delegate)
     return self.__downloadPage('/account/verify_credentials.xml', parser)