def _get_xsrf_dc0(self, url=None): """ 获取某个URL页面下的xsrf :param url: :return: xsrf """ response = self.get(url or URL.index()) xsrf = response.cookies["_xsrf"] dc0 = response.cookies["d_c0"] return xsrf, dc0
def _get_xsrf(self, url=None): """ 获取某个URL页面下的xsrf :param url: :return: xsrf """ response = self.get(url or URL.index()) soup = BeautifulSoup(response.content, "lxml") xsrf = soup.find('input', attrs={"name": "_xsrf"}).get("value") return xsrf
def _get_xsrf(self, url=None, **kwargs): """ 获取某个页面下的xsrf :param url: :param kwargs: :return: """ response = self._session.get(url or URL.index(), **kwargs) soup = BeautifulSoup(response.content, "html.parser") xsrf = soup.find('input', attrs={"name": "_xsrf"}).get("value") return xsrf
def _get_xsrf(self, **kwargs): response = self._session.get(URL.index(), **kwargs) soup = BeautifulSoup(response.content, "html.parser") xsrf = soup.find('input', attrs={"name": "_xsrf"}).get("value") return xsrf