Esempio n. 1
0
 def request_by_proxy(self, *args, **kwargs) -> requests.Response:
     use_rss_proxy = _proxy_helper.choice_proxy(
         proxy_url=self.proxy_url, rss_proxy_url=self.rss_proxy_url)
     if use_rss_proxy:
         if not self.rss_proxy_url:
             raise ValueError("rss_proxy_url not provided")
         return self._request_by_rss_proxy(*args, **kwargs)
     else:
         if not self.proxy_url:
             raise ValueError("proxy_url not provided")
         proxies = {'http': self.proxy_url, 'https': self.proxy_url}
         return self.request_direct(*args, **kwargs, proxies=proxies)
Esempio n. 2
0
 def _choice_proxy(self) -> bool:
     return _proxy_helper.choice_proxy(proxy_url=self.proxy_url,
                                       rss_proxy_url=self.rss_proxy_url)