testing
Browse files- App/Chat/PoeChatrouter.py +10 -6
App/Chat/PoeChatrouter.py
CHANGED
|
@@ -9,11 +9,6 @@ from ballyregan import ProxyFetcher
|
|
| 9 |
|
| 10 |
# Setting the debug mode to True, defaults to False
|
| 11 |
fetcher = ProxyFetcher()
|
| 12 |
-
proxies = fetcher.get(
|
| 13 |
-
limit=10,
|
| 14 |
-
protocols=[Protocols.HTTP],
|
| 15 |
-
anonymities=[Anonymities.ELITE],
|
| 16 |
-
)
|
| 17 |
|
| 18 |
|
| 19 |
chat_router = APIRouter(tags=["Chat"])
|
|
@@ -26,9 +21,17 @@ class InputData(BaseModel):
|
|
| 26 |
|
| 27 |
|
| 28 |
async def fetch_predictions(data):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
async with ClientSession() as session:
|
| 30 |
for p in proxies:
|
| 31 |
-
if
|
| 32 |
if p != proxy:
|
| 33 |
continue
|
| 34 |
try:
|
|
@@ -44,6 +47,7 @@ async def fetch_predictions(data):
|
|
| 44 |
return await response.json(), response.status
|
| 45 |
except:
|
| 46 |
pass
|
|
|
|
| 47 |
|
| 48 |
|
| 49 |
async def fetch_result(id):
|
|
|
|
| 9 |
|
| 10 |
# Setting the debug mode to True, defaults to False
|
| 11 |
fetcher = ProxyFetcher()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
|
| 14 |
chat_router = APIRouter(tags=["Chat"])
|
|
|
|
| 21 |
|
| 22 |
|
| 23 |
async def fetch_predictions(data):
|
| 24 |
+
proxy_set = proxy != ""
|
| 25 |
+
if not proxy_set:
|
| 26 |
+
proxies = fetcher.get(
|
| 27 |
+
limit=10,
|
| 28 |
+
protocols=[Protocols.HTTP],
|
| 29 |
+
anonymities=[Anonymities.ELITE],
|
| 30 |
+
)
|
| 31 |
+
|
| 32 |
async with ClientSession() as session:
|
| 33 |
for p in proxies:
|
| 34 |
+
if proxy_set:
|
| 35 |
if p != proxy:
|
| 36 |
continue
|
| 37 |
try:
|
|
|
|
| 47 |
return await response.json(), response.status
|
| 48 |
except:
|
| 49 |
pass
|
| 50 |
+
proxy = ""
|
| 51 |
|
| 52 |
|
| 53 |
async def fetch_result(id):
|