fix region parsing
This commit is contained in:
		@@ -1,5 +1,6 @@
 | 
				
			|||||||
import json
 | 
					import json
 | 
				
			||||||
import sys
 | 
					import sys
 | 
				
			||||||
 | 
					import pprint
 | 
				
			||||||
import os
 | 
					import os
 | 
				
			||||||
import re
 | 
					import re
 | 
				
			||||||
import base64
 | 
					import base64
 | 
				
			||||||
@@ -41,7 +42,7 @@ class ProxyElem():
 | 
				
			|||||||
        timeout = aiohttp.ClientTimeout(total=5)
 | 
					        timeout = aiohttp.ClientTimeout(total=5)
 | 
				
			||||||
        return aiohttp.ClientSession(timeout=timeout)
 | 
					        return aiohttp.ClientSession(timeout=timeout)
 | 
				
			||||||
    def __repr__(self):
 | 
					    def __repr__(self):
 | 
				
			||||||
        return str(self.proxy)
 | 
					        return f"<region=<{str(self.region)}> proxy=<{str(self.proxy)}>>"
 | 
				
			||||||
    async def proxy_url(self, urls):
 | 
					    async def proxy_url(self, urls):
 | 
				
			||||||
        clean_urls = []
 | 
					        clean_urls = []
 | 
				
			||||||
        for url in urls:
 | 
					        for url in urls:
 | 
				
			||||||
@@ -130,7 +131,7 @@ for key in providers:
 | 
				
			|||||||
                region_current_keys.add(f'{key}_{region_country}')
 | 
					                region_current_keys.add(f'{key}_{region_country}')
 | 
				
			||||||
        region = os.environ.get(match)
 | 
					        region = os.environ.get(match)
 | 
				
			||||||
        if region is not None:
 | 
					        if region is not None:
 | 
				
			||||||
            region_current.append(proxy)
 | 
					            region_current.append(region)
 | 
				
			||||||
            region_countries.append(region_country)
 | 
					            region_countries.append(region_country)
 | 
				
			||||||
            if region_country is None:
 | 
					            if region_country is None:
 | 
				
			||||||
                region_empty = False
 | 
					                region_empty = False
 | 
				
			||||||
@@ -138,7 +139,6 @@ for key in providers:
 | 
				
			|||||||
    for elem in proxy_current_keys:
 | 
					    for elem in proxy_current_keys:
 | 
				
			||||||
        proxies[elem] = []
 | 
					        proxies[elem] = []
 | 
				
			||||||
        new_providers[elem] = providers[key]
 | 
					        new_providers[elem] = providers[key]
 | 
				
			||||||
    print(proxies)
 | 
					 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    for proxy, region, country in zip(proxy_current, region_current, proxy_countries):
 | 
					    for proxy, region, country in zip(proxy_current, region_current, proxy_countries):
 | 
				
			||||||
        new_key = key
 | 
					        new_key = key
 | 
				
			||||||
@@ -150,6 +150,8 @@ for key in providers:
 | 
				
			|||||||
        if len(proxies[elem]) == 0:
 | 
					        if len(proxies[elem]) == 0:
 | 
				
			||||||
            proxies[elem].append(ProxyElem(None, None))
 | 
					            proxies[elem].append(ProxyElem(None, None))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					pprint.pp(proxies)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
providers = new_providers
 | 
					providers = new_providers
 | 
				
			||||||
 | 
					
 | 
				
			||||||
proxy_keys = []
 | 
					proxy_keys = []
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user