def __get_request_token(self): url = self.__gen_oauth_url('request_token') res = requests.post(url,{'oauth_callback':self.callback_url},hooks={'pre_request':self._consumer}) qs = Utils.parse_qs(res.text) request_token = qs['oauth_token'][0] request_secret = qs['oauth_token_secret'][0] return request_token, request_secret
def get_access_token(self,verifier): url = self.__gen_oauth_url('access_token') self._consumer.token = Token(self.__request_tokens[0],self.__request_tokens[1]) res = requests.post(url,{'oauth_verifier':verifier},hooks={'pre_request':self._consumer}) qs = Utils.parse_qs(res.content) access_token = qs['oauth_token'][0] access_token_secret = qs['oauth_token_secret'][0] self.__access_tokens = [access_token,access_token_secret] return self.__access_tokens