From c46510406ba7c2f86234094a80d0e8684cf645c6 Mon Sep 17 00:00:00 2001 From: amd64fox <62529699+amd64fox@users.noreply.github.com> Date: Thu, 29 Jun 2023 19:01:39 +0300 Subject: [PATCH] formatting fixed --- upd.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/upd.py b/upd.py index 13ff639..b2b4312 100644 --- a/upd.py +++ b/upd.py @@ -27,6 +27,7 @@ async def check_url(session, url, platform_name): pass return None + async def send_request(json_data): url = u + json_data async with aiohttp.ClientSession() as session: @@ -37,6 +38,7 @@ async def send_request(json_data): system_response = soup.find('div', style='text-align:center;font-family:monospace;margin:50px auto 0;max-width:600px').text print(f'Ответ от Google apps script: {system_response}') + async def main(): start_number = 0 before_enter = 5500 @@ -45,14 +47,13 @@ async def main(): find_url = [] win32 = "https://upgrade.scdn.co/upgrade/client/win32-x86/spotify_installer-{version}-{numbers}.exe" - win64 = "https://upgrade.scdn.co/upgrade/client/win32-x86_64/spotify_installer-{version_spoti}-{numbers}.exe" + win64 = "https://upgrade.scdn.co/upgrade/client/win32-x86_64/spotify_installer-{version}-{numbers}.exe" win_arm64 = "https://upgrade.scdn.co/upgrade/client/win32-arm64/spotify_installer-{version}-{numbers}.exe" osx = "https://upgrade.scdn.co/upgrade/client/osx-x86_64/spotify-autoupdate-{version}-{numbers}.tbz" osx_arm64 = "https://upgrade.scdn.co/upgrade/client/osx-arm64/spotify-autoupdate-{version}-{numbers}.tbz" async with aiohttp.ClientSession() as session: tasks = [] - url_templates = [win32, win64, win_arm64, osx, osx_arm64] platform_names = ["WIN32", "WIN64", "WIN-ARM64", "OSX", "OSX-ARM64"] @@ -66,18 +67,18 @@ async def main(): numbers += 1 results = [] - for task in asyncio.as_completed(tasks): result = await task if result is not None: find_url.append(result) + if find_url: platform_urls = {} for item in find_url: if isinstance(item, tuple): url, platform_name = item if platform_name not in platform_urls: - platform_urls[platform_name] = str(url) # Преобразование URL в строку + platform_urls[platform_name] = str(url) else: if "unknown" not in platform_urls: platform_urls["unknown"] = "unknown" @@ -96,4 +97,4 @@ async def main(): await send_request(req_ver) -asyncio.run(main()) \ No newline at end of file +asyncio.run(main())