| Server IP : 127.0.1.1 / Your IP : 216.73.216.17 Web Server : Apache/2.4.58 (Ubuntu) System : Linux dalsi.io 6.8.0-117-generic #117-Ubuntu SMP PREEMPT_DYNAMIC Tue May 5 19:26:24 UTC 2026 x86_64 User : www-data ( 33) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /usr/share/doc/python3-aiohttp/examples/ |
Upload File : |
#!/usr/bin/env python3
import asyncio
import aiohttp
async def fetch(session):
print("Query http://httpbin.org/basic-auth/andrew/password")
async with session.get("http://httpbin.org/basic-auth/andrew/password") as resp:
print(resp.status)
body = await resp.text()
print(body)
async def go(loop):
async with aiohttp.ClientSession(
auth=aiohttp.BasicAuth("andrew", "password"), loop=loop
) as session:
await fetch(session)
loop = asyncio.get_event_loop()
loop.run_until_complete(go(loop))