import aiohttp import asyncio Configuration URL = 'http://evander.wtf' REQUESTCOUNT =…
- User
import aiohttp import asyncio
Configuration
URL = 'http://evander.wtf' REQUEST_COUNT = 100000 # Reduced for testing
async def fetch_url(session, index): try: async with session.get(URL) as response: status_code = response.status # Print status code and a brief message print(f"Request {index + 1}: Status Code: {status_code}") except Exception as e: print(f"An error occurred: {e}")
async def main(): async with aiohttp.ClientSession() as session: tasks = [fetch_url(session, i) for i in range(REQUEST_COUNT)] await asyncio.gather(*tasks)
codeprint("Finished making requests.")if name == "main": asyncio.run(main())
What does this script do
- Assistant