def confirm(self): """ Confirms the application and receives the token """ url = "https://oauth.vk.com/authorize/" values = {"display": "mobile", "scope": SCOPE, "client_id": APP_ID, "response_type": "token", "redirect_uri": "https://oauth.vk.com/blank.html"} token = None body, response = self.get(url, values) if response: if "access_token" in response.url: match = token_exp.search(response.url) if match: token = match.group(0) else: logger.error("token regexp doesn't match the url: %s", response.url) raise AuthError("Something went wrong. We're so sorry.") else: postTarget = webtools.getTagArg("form method=\"post\"", "action", body, "form") if postTarget: body, response = self.post(postTarget) token = token_exp.search(response.url).group(0) else: raise AuthError("Couldn't confirm the application!") return token
def confirmThisApp(self): """ Confirms your application and receives the token """ url = "https://oauth.vk.com/authorize/" values = { "display": "mobile", "scope": self.scope, "client_id": self.app_id, "response_type": "token", "redirect_uri": "https://oauth.vk.com/blank.html" } token = None body, response = self.RIP.get(url, values) if response: if "access_token" in response.url: token = token_exp.search(response.url).group(0) else: postTarget = webtools.getTagArg("form method=\"post\"", "action", body, "form") if postTarget: body, response = self.RIP.post(postTarget) token = token_exp.search(response.url).group(0) else: raise AuthError("Couldn't execute confirmThisApp()!") self.token = token
def confirmThisApp(self): url = "https://oauth.vk.com/authorize/" values = {"display": "mobile", "scope": self.scope, "client_id": self.app_id, "response_type": "token", "redirect_uri": "https://oauth.vk.com/blank.html"} token = None body, response = self.RIP.get(url, values) if response: if "access_token" in response.url: token = response.url.split("=")[1].split("&")[0] else: postTarget = webtools.getTagArg("form method=\"post\"", "action", body, "form") if postTarget: body, response = self.RIP.post(postTarget) token = response.url.split("=")[1].split("&")[0] else: raise AuthError("Couldn't execute confirmThisApp()!") self.token = token
def api_login(self): url = "https://oauth.vk.com/authorize" values = { "display": "mobile", "scope": self.scope, "client_id": self.app_id, "response_type": "token", "redirect_uri": "https://oauth.vk.com/blank.html" } token = None GET = self.http.get(url, params = values) getUrl = GET.url if "access_token" in getUrl: token = getUrl.split("=")[1].split("&")[0] else: POST = webtools.getTagArg("form method=\"post\"", "action", GET.text, "form") if POST: response = self.http.post(POST) token = response.url.split("=")[1].split("&")[0] else: raise authError("ApiError") self.token = token
def confirmThisApp(self): url = "https://oauth.vk.com/authorize" values = {"display": "mobile", "scope": self.scope, "client_id": self.app_id, "response_type": "token", "redirect_uri": "https://oauth.vk.com/blank.html" } token = None body, response = self.RIP.get(url, values) if response: if "access_token" in response.url: token = response.url.split("=")[1].split("&")[0] else: postTarget = webtools.getTagArg("form method=\"post\"", "action", body, "form") if postTarget: body, response = self.RIP.post(postTarget) token = response.url.split("=")[1].split("&")[0] else: raise AuthError("Couldn't execute confirmThisApp()!") self.token = token
def confirmThisApp(self): """ Confirms your application and receives the token """ url = "https://oauth.vk.com/authorize/" values = {"display": "mobile", "scope": self.scope, "client_id": self.app_id, "response_type": "token", "redirect_uri": "https://oauth.vk.com/blank.html"} token = None body, response = self.RIP.get(url, values) if response: if "access_token" in response.url: token = token_exp.search(response.url).group(0) else: postTarget = webtools.getTagArg("form method=\"post\"", "action", body, "form") if postTarget: body, response = self.RIP.post(postTarget) token = token_exp.search(response.url).group(0) else: raise AuthError("Couldn't execute confirmThisApp()!") self.token = token