Authorize an application using oauth. If this function returns True, the obtained oauth token can be retrieved using getResponse and will be in url-parameters format.
            TODO: allow the option to ask the user himself for permission, instead of doing this automatically. Especially important for web applications.
            
            @param oauth_duration (string) (optional) -'hour', 'day', 'week', 'year', 'forever'
            
            @return (boolean) - Boolean indicating whether OauthAuthorizeApplication was successful

def OauthAuthorizeApplication(self, oauth_duration = 'hour'):
        """
            Authorize an application using oauth. If this function returns True, the obtained oauth token can be retrieved using getResponse and will be in url-parameters format.
            TODO: allow the option to ask the user himself for permission, instead of doing this automatically. Especially important for web applications.
            
            @param oauth_duration (string) (optional) -'hour', 'day', 'week', 'year', 'forever'
            
            @return (boolean) - Boolean indicating whether OauthAuthorizeApplication was successful
        """
        if self.__session_id__ == '':
            self.__error__ = "not logged in"
            return False

    # automatically get authorization for the application
        parameters = {'oauth_token':self.__oauth_token__.key, 'tok_expir':self.__OauthGetTokExpir__(oauth_duration), 'action':'ALLOW', 'session_id':self.__session_id__}

        if self.__SenseApiCall__('/oauth/provider_authorize', 'POST', parameters = parameters):
            if self.__status__ == 302:
                response = urlparse.parse_qs(urlparse.urlparse(self.__headers__['location'])[4])
                verifier = response['oauth_verifier'][0]
                self.__oauth_token__.set_verifier(verifier)
                return True
            else:
                self.__setAuthenticationMethod__('session_id')
                self.__error__ = "error authorizing application"
                return False
        else:
            self.__setAuthenticationMethod__('session_id')
            self.__error__ = "error authorizing application"
            return False