Update ccc.py
Browse files
ccc.py
CHANGED
@@ -5,6 +5,10 @@ import random
|
|
5 |
import multiprocessing
|
6 |
from dateutil import parser
|
7 |
import os
|
|
|
|
|
|
|
|
|
8 |
|
9 |
discord_webhook_url = os.environ['webhook']
|
10 |
api_batch_url = "https://epic-alligator-77.deno.dev/post"
|
@@ -45,9 +49,8 @@ async def send_to_discord(session, asset_id, name, creator_id, creator_name, cre
|
|
45 |
|
46 |
try:
|
47 |
async with session.post(discord_webhook_url, json=embed) as response:
|
48 |
-
|
49 |
-
|
50 |
-
except (aiohttp.ClientError, ConnectionError):
|
51 |
pass
|
52 |
|
53 |
async def check_asset_batch(session, asset_ids):
|
@@ -71,7 +74,7 @@ async def check_asset_batch(session, asset_ids):
|
|
71 |
tasks.append(fetch_asset_info(session, asset_id))
|
72 |
|
73 |
await asyncio.gather(*tasks)
|
74 |
-
except (aiohttp.ClientError, ConnectionError):
|
75 |
pass
|
76 |
|
77 |
async def fetch_asset_info(session, asset_id):
|
@@ -100,7 +103,7 @@ async def fetch_asset_info(session, asset_id):
|
|
100 |
with valid_assets_found.get_lock():
|
101 |
valid_assets_found.value += 1
|
102 |
await send_to_discord(session, asset_id, name, creator_id, creator_name, creator_type, asset_type, created_date_formatted)
|
103 |
-
except (aiohttp.ClientError, ConnectionError):
|
104 |
pass
|
105 |
|
106 |
def parse_iso8601(date_str):
|
@@ -131,8 +134,8 @@ async def run_scanner_instance(digit):
|
|
131 |
async with aiohttp.ClientSession() as session:
|
132 |
batch = generate_ids_batch(digit)
|
133 |
await check_asset_batch(session, batch)
|
134 |
-
except (aiohttp.ClientError, ConnectionError):
|
135 |
-
|
136 |
|
137 |
async def print_status_periodically():
|
138 |
while True:
|
|
|
5 |
import multiprocessing
|
6 |
from dateutil import parser
|
7 |
import os
|
8 |
+
import logging
|
9 |
+
|
10 |
+
# Disable all logging except for critical errors
|
11 |
+
logging.basicConfig(level=logging.CRITICAL)
|
12 |
|
13 |
discord_webhook_url = os.environ['webhook']
|
14 |
api_batch_url = "https://epic-alligator-77.deno.dev/post"
|
|
|
49 |
|
50 |
try:
|
51 |
async with session.post(discord_webhook_url, json=embed) as response:
|
52 |
+
await response.text()
|
53 |
+
except (aiohttp.ClientError, asyncio.TimeoutError, ConnectionError):
|
|
|
54 |
pass
|
55 |
|
56 |
async def check_asset_batch(session, asset_ids):
|
|
|
74 |
tasks.append(fetch_asset_info(session, asset_id))
|
75 |
|
76 |
await asyncio.gather(*tasks)
|
77 |
+
except (aiohttp.ClientError, asyncio.TimeoutError, ConnectionError):
|
78 |
pass
|
79 |
|
80 |
async def fetch_asset_info(session, asset_id):
|
|
|
103 |
with valid_assets_found.get_lock():
|
104 |
valid_assets_found.value += 1
|
105 |
await send_to_discord(session, asset_id, name, creator_id, creator_name, creator_type, asset_type, created_date_formatted)
|
106 |
+
except (aiohttp.ClientError, asyncio.TimeoutError, ConnectionError):
|
107 |
pass
|
108 |
|
109 |
def parse_iso8601(date_str):
|
|
|
134 |
async with aiohttp.ClientSession() as session:
|
135 |
batch = generate_ids_batch(digit)
|
136 |
await check_asset_batch(session, batch)
|
137 |
+
except (aiohttp.ClientError, asyncio.TimeoutError, ConnectionError):
|
138 |
+
await asyncio.sleep(1) # Add a small delay before retrying
|
139 |
|
140 |
async def print_status_periodically():
|
141 |
while True:
|