def callback(self, request, **kwargs):
        """
            Called from the Service when the user accept to activate it
            the url to go back after the external service call
            :param request: contains the current session
            :param kwargs: keyword args
            :type request: dict
            :type kwargs: dict
            :rtype: string
        """
        code = request.GET.get('code', '')
        redirect_uri = '%s://%s%s' % (request.scheme, request.get_host(), reverse("reddit_callback"))
        reddit = RedditApi(client_id=self.consumer_key,
                           client_secret=self.consumer_secret,
                           redirect_uri=redirect_uri,
                           user_agent=self.user_agent)
        token = reddit.auth.authorize(code)

        UserService.objects.filter(user=request.user, name='ServiceReddit').update(token=token)
        return 'reddit/callback.html'
def callback ( self , request , ** kwargs ) : code = request . GET . get ( 'code' , '' ) redirect_uri = '%s://%s%s' % ( request . scheme , request . get_host ( ) , reverse ( "reddit_callback" ) ) reddit = RedditApi ( client_id = self . consumer_key , client_secret = self . consumer_secret , redirect_uri = redirect_uri , user_agent = self . user_agent ) token = reddit . auth . authorize ( code ) UserService . objects . filter ( user = request . user , name = 'ServiceReddit' ) . update ( token = token ) return 'reddit/callback.html'
Called from the Service when the user accept to activate it
            the url to go back after the external service call
            :param request: contains the current session
            :param kwargs: keyword args
            :type request: dict
            :type kwargs: dict
            :rtype: string