Pilotdog 查询脚本

import asyncio
import sys

import aiohttp

eth_addresses = [
    '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045',
]

async def fetch_info(session, address):
    url = f'https://www.pilotdog.tech/api/get_eligible?address={address}'
    async with session.get(url) as response:
        if response.status == 200:
            return address, await response.text() 
        else:
            print(f"Failed to fetch info for {address}. Status code: {response.status}")
            return address, None

async def main():
    async with aiohttp.ClientSession() as session:
        tasks = [fetch_info(session, address) for address in eth_addresses]
        results = await asyncio.gather(*tasks)
        for address, response in results:
            print(f"Address: {address}, Response: {response}")

if __name__ == '__main__':
    if sys.platform == 'win32':
        asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
    asyncio.run(main())

你可能感兴趣的:(python实践web3开发,java,前端,javascript,点云,c++)