remove aiohttp session

This commit is contained in:
Roy Olav Purser 2021-06-04 11:46:18 +02:00
parent 28db68178c
commit fcae9bb0ce
Signed by: roypur
GPG Key ID: E14D26A036F21656

View File

@ -1,7 +1,6 @@
#!/usr/bin/env python3
import json
import sys
import urllib.parse
import os
import base64
import logging
@ -10,7 +9,6 @@ import tornado.web
import tornado.routing
import stream_providers
import aiohttp
import aiohttp_socks
logging.basicConfig(format='[%(filename)s:%(lineno)d] %(message)s', stream=sys.stdout, level=logging.INFO)
logger = logging.getLogger(__name__)
@ -36,12 +34,6 @@ class ProxyElem():
def local(self):
timeout = aiohttp.ClientTimeout(total=5)
return aiohttp.ClientSession(timeout=timeout)
def session(self):
connector = None
if self.proxy is not None:
connector = aiohttp_socks.ProxyConnector.from_url("socks5://" + self.proxy)
timeout = aiohttp.ClientTimeout(total=2)
return aiohttp.ClientSession(connector=connector, timeout=timeout)
def __repr__(self):
return str(self.proxy)
async def proxy_url(self, urls):