コード例 #1
0
    def __get_list(self, search_line: str, show_number: int) -> frozenset:
        search_url = self.__make_url(search_line, show_number)

        sock = global_functions._connect(search_url)

        if sock.url != search_url:
            return frozenset([parse.urlsplit(sock.url).path])

        html = bs4.BeautifulSoup(sock.text)
        div_content = html.find(name='div', attrs={'id': 'content'})
        divs_pic = div_content.findAll(name='div', attrs={'class': 'picSurround'})
        return frozenset(map(lambda x: x.a['href'], divs_pic))
コード例 #2
0
    def __get_list(self, search_line: str, show_number: int) -> frozenset:
        search_url = self.__make_url(search_line, show_number)

        sock = global_functions._connect(search_url)

        if sock.url != search_url:
            return frozenset([parse.urlsplit(sock.url).path])

        html = bs4.BeautifulSoup(sock.text)
        div_content = html.find(name='div', attrs={'id': 'content'})
        divs_pic = div_content.findAll(name='div',
                                       attrs={'class': 'picSurround'})
        return frozenset(map(lambda x: x.a['href'], divs_pic))
コード例 #3
0
ファイル: account.py プロジェクト: StalinDan/Appium_Advance
    def auth_connect(self, url: str, data: str or None=None,
                     headers: dict or None=None) -> str:
        """
        :param url: The url to get.
        :type url: str
        :param data: The data to pass (will change the request to "POST")
        :type data: str or None
        :param headers: Headers for the request.
        :type headers: dict or None
        :returns: data after using the account authenticate to get the data.
        :rtype: str
        """
        from pymal import exceptions

        if not self.is_auth:
            raise exceptions.UnauthenticatedAccountError(self.username)
        return global_functions._connect(url, data=data, headers=headers,
                                         auth=self.__auth_object, session=self.__session).text.strip()
コード例 #4
0
ファイル: account.py プロジェクト: pymal-developers/pymal
    def auth_connect(self, url: str, data: str or None = None, headers: dict or None = None) -> str:
        """
        :param url: The url to get.
        :type url: str
        :param data: The data to pass (will change the request to "POST")
        :type data: str or None
        :param headers: Headers for the request.
        :type headers: dict or None
        :returns: data after using the account authenticate to get the data.
        :rtype: str
        """
        from pymal import exceptions

        if not self.is_auth:
            raise exceptions.UnauthenticatedAccountError(self.username)
        return global_functions._connect(
            url, data=data, headers=headers, auth=self.__auth_object, session=self.__session
        ).text.strip()