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))
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()
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()