diff options
author | Michael Yick <cavemanon@mail.snootgame.xyz> | 2023-02-27 17:34:37 -0600 |
---|---|---|
committer | Michael Yick <cavemanon@mail.snootgame.xyz> | 2023-02-27 17:34:37 -0600 |
commit | 9ca9664e56cff70c6484ae8a77cfd03486f57248 (patch) | |
tree | c03bafdda142eeeaeee4a4e81b0f61234918f663 /main.py | |
parent | 42f3eecc8ebcae73088fc2f02f1ede2d65c36228 (diff) | |
download | dilbertRss-9ca9664e56cff70c6484ae8a77cfd03486f57248.tar.gz dilbertRss-9ca9664e56cff70c6484ae8a77cfd03486f57248.tar.bz2 dilbertRss-9ca9664e56cff70c6484ae8a77cfd03486f57248.zip |
enable tor support
Diffstat (limited to 'main.py')
-rwxr-xr-x | main.py | 16 |
1 files changed, 3 insertions, 13 deletions
@@ -28,20 +28,10 @@ async def root(): adapter = HTTPAdapter(max_retries=retry) session.mount('http://', adapter) session.mount('https://', adapter) + session.proxies = {'http': 'socks5://127.0.0.1:9050', 'https': 'socks5://127.0.0.1:9050'} + + search = session.get("https://dilbert.com/strip/" + date) - session.get("https://dilbert.com/strip/" + date) - - tries = 25 - for i in range(tries): - search = requests.get("https://dilbert.com/strip/" + date) - if search.status_code == 503: - if i < tries - 1: - time.sleep(1) - continue - else: - raise - break - soup = bs4.BeautifulSoup(search.text, features="lxml") comicTitle = soup.find("meta", property="og:title")["content"] comicURL = soup.find("meta", property="og:image")["content"] |