| skipped 126 lines |
127 | 127 | | return str(html_text), status_code, error |
128 | 128 | | |
129 | 129 | | |
130 | | - | class TorAiohttpChecker(SimpleAiohttpChecker): |
| 130 | + | class ProxiedAiohttpChecker(SimpleAiohttpChecker): |
131 | 131 | | def __init__(self, *args, **kwargs): |
132 | 132 | | proxy = kwargs.get('proxy') |
133 | 133 | | cookie_jar = kwargs.get('cookie_jar') |
| skipped 422 lines |
556 | 556 | | query_notify=None, |
557 | 557 | | proxy=None, |
558 | 558 | | tor_proxy=None, |
| 559 | + | i2p_proxy=None, |
559 | 560 | | timeout=3, |
560 | 561 | | is_parsing_enabled=False, |
561 | 562 | | id_type="username", |
| skipped 59 lines |
621 | 622 | | # TODO |
622 | 623 | | tor_checker = CheckerMock() |
623 | 624 | | if tor_proxy: |
624 | | - | tor_checker = TorAiohttpChecker( # type: ignore |
| 625 | + | tor_checker = ProxiedAiohttpChecker( # type: ignore |
625 | 626 | | proxy=tor_proxy, cookie_jar=cookie_jar, logger=logger |
| 627 | + | ) |
| 628 | + | |
| 629 | + | # TODO |
| 630 | + | i2p_checker = CheckerMock() |
| 631 | + | if i2p_proxy: |
| 632 | + | i2p_checker = ProxiedAiohttpChecker( # type: ignore |
| 633 | + | proxy=i2p_proxy, cookie_jar=cookie_jar, logger=logger |
626 | 634 | | ) |
627 | 635 | | |
628 | 636 | | # TODO |
| skipped 20 lines |
649 | 657 | | '': clearweb_checker, |
650 | 658 | | 'tor': tor_checker, |
651 | 659 | | 'dns': dns_checker, |
| 660 | + | 'i2p': i2p_checker, |
652 | 661 | | } |
653 | 662 | | options["parsing"] = is_parsing_enabled |
654 | 663 | | options["timeout"] = timeout |
| skipped 50 lines |
705 | 714 | | await clearweb_checker.close() |
706 | 715 | | if tor_proxy: |
707 | 716 | | await tor_checker.close() |
| 717 | + | if i2p_proxy: |
| 718 | + | await i2p_checker.close() |
708 | 719 | | |
709 | 720 | | # notify caller that all queries are finished |
710 | 721 | | query_notify.finish() |
| skipped 33 lines |
744 | 755 | | db: MaigretDatabase, |
745 | 756 | | silent=False, |
746 | 757 | | tor_proxy=None, |
| 758 | + | i2p_proxy=None, |
747 | 759 | | ): |
748 | 760 | | changes = { |
749 | 761 | | "disabled": False, |
| skipped 18 lines |
768 | 780 | | no_progressbar=True, |
769 | 781 | | retries=1, |
770 | 782 | | tor_proxy=tor_proxy, |
| 783 | + | i2p_proxy=i2p_proxy, |
771 | 784 | | ) |
772 | 785 | | |
773 | 786 | | # don't disable entries with other ids types |
| skipped 49 lines |
823 | 836 | | silent=False, |
824 | 837 | | max_connections=10, |
825 | 838 | | tor_proxy=None, |
| 839 | + | i2p_proxy=None, |
826 | 840 | | ) -> bool: |
827 | 841 | | sem = asyncio.Semaphore(max_connections) |
828 | 842 | | tasks = [] |
| skipped 5 lines |
834 | 848 | | disabled_old_count = disabled_count(all_sites.values()) |
835 | 849 | | |
836 | 850 | | for _, site in all_sites.items(): |
837 | | - | check_coro = site_self_check(site, logger, sem, db, silent, tor_proxy) |
| 851 | + | check_coro = site_self_check( |
| 852 | + | site, logger, sem, db, silent, tor_proxy, i2p_proxy |
| 853 | + | ) |
838 | 854 | | future = asyncio.ensure_future(check_coro) |
839 | 855 | | tasks.append(future) |
840 | 856 | | |
| skipped 20 lines |