remove aiohttp session
This commit is contained in:
		@@ -1,7 +1,6 @@
 | 
				
			|||||||
#!/usr/bin/env python3
 | 
					#!/usr/bin/env python3
 | 
				
			||||||
import json
 | 
					import json
 | 
				
			||||||
import sys
 | 
					import sys
 | 
				
			||||||
import urllib.parse
 | 
					 | 
				
			||||||
import os
 | 
					import os
 | 
				
			||||||
import base64
 | 
					import base64
 | 
				
			||||||
import logging
 | 
					import logging
 | 
				
			||||||
@@ -10,7 +9,6 @@ import tornado.web
 | 
				
			|||||||
import tornado.routing
 | 
					import tornado.routing
 | 
				
			||||||
import stream_providers
 | 
					import stream_providers
 | 
				
			||||||
import aiohttp
 | 
					import aiohttp
 | 
				
			||||||
import aiohttp_socks
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
logging.basicConfig(format='[%(filename)s:%(lineno)d] %(message)s', stream=sys.stdout, level=logging.INFO)
 | 
					logging.basicConfig(format='[%(filename)s:%(lineno)d] %(message)s', stream=sys.stdout, level=logging.INFO)
 | 
				
			||||||
logger = logging.getLogger(__name__)
 | 
					logger = logging.getLogger(__name__)
 | 
				
			||||||
@@ -36,12 +34,6 @@ class ProxyElem():
 | 
				
			|||||||
    def local(self):
 | 
					    def local(self):
 | 
				
			||||||
        timeout = aiohttp.ClientTimeout(total=5)
 | 
					        timeout = aiohttp.ClientTimeout(total=5)
 | 
				
			||||||
        return aiohttp.ClientSession(timeout=timeout)
 | 
					        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):
 | 
					    def __repr__(self):
 | 
				
			||||||
        return str(self.proxy)
 | 
					        return str(self.proxy)
 | 
				
			||||||
    async def proxy_url(self, urls):
 | 
					    async def proxy_url(self, urls):
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user