예제 #1
0
파일: sessions.py 프로젝트: Fahreeve/aiovk
    async def _process_auth_form(self, html: str) -> (str, str):
        """
        Parsing data from authorization page and filling the form and submitting the form

        :param html: html page
        :return: url and  html from redirected page
        """
        # Parse page
        p = AuthPageParser()
        p.feed(html)
        p.close()

        # Get data from hidden inputs
        form_data = dict(p.inputs)
        form_url = p.url
        form_data['email'] = self.login
        form_data['pass'] = self.password
        if p.message:
            # Show form errors
            raise VkAuthError('invalid_data', p.message, form_url, form_data)
        elif p.captcha_url:
            form_data['captcha_key'] = await self.enter_captcha(
                "https://m.vk.com{}".format(p.captcha_url),
                form_data['captcha_sid']
            )
            form_url = "https://m.vk.com{}".format(form_url)

        # Send request
        url, html = await self.driver.post_text(form_url, form_data)
        return url, html
예제 #2
0
    async def _process_auth_form(self, html: str) -> (str, str):
        """
        Parsing data from authorization page and filling the form and submitting the form

        :param html: html page
        :return: url and  html from redirected page
        """
        # Parse page
        p = AuthPageParser()
        p.feed(html)
        p.close()

        # Get data from hidden inputs
        form_data = dict(p.inputs)
        form_url = p.url
        form_data['email'] = self.login
        form_data['pass'] = self.password
        if p.message:
            # Show form errors
            raise VkAuthError('invalid_data', p.message, form_url, form_data)
        elif p.captcha_url:
            form_data['captcha_key'] = await self.enter_captcha(
                "https://m.vk.com{}".format(p.captcha_url),
                form_data['captcha_sid'])
            form_url = "https://m.vk.com{}".format(form_url)

        # Send request
        url, html = await self.driver.post_text(form_url, form_data)
        return url, html
예제 #3
0
파일: sessions.py 프로젝트: bosha/aiovk
 async def process_auth_form(self, html):
     p = AuthPageParser()
     p.feed(html)
     p.close()
     form_data = dict(p.inputs)
     form_url = p.url
     form_data['email'] = self.login
     form_data['pass'] = self.password
     if p.message:
         raise VkAuthError('invalid_data', p.message, form_url, form_data)
     elif p.captcha_url:
         form_data['captcha_key'] = await self.enter_captcha(p.captcha_url, form_data['captcha_sid'])
     url, html = await self.driver.post_text(form_url, form_data)
     return url, html