![]() | |
ADVAN Laptop TBook Celeron N100SPESIFIKASI Advan Soulmate : Processor: Intel® Gemini Lake N4020, Graphics: Intel® Integrated Graphics, Memory: 4GB DDR4 (upgradable), Storage: 128GB (upgradable), Display: 14 inch HD 1366*768, Battery: 5000mAh 38wh, Connection: WiFi 802.11 b/g/n/ac + Bluetooth 4.2, Camera: 2.0 MP Free Klik Disini ! |
Python 3.5 keatas, menambahkan beberapa sintaks baru yang memungkinkan pengembang membuat aplikasi dan paket asinkron lebih mudah. Salah satu paket tersebut adalah aiohttp yang merupakan client / server HTTP untuk asyncio.
Pada dasarnya ini memungkinkan Anda untuk menulis asynchronous klien dan server. Paket aiohttp juga mendukung Server WebSockets dan Client WebSockets. Anda bisa menginstal aiohttp menggunakan pip :
pip install aiohttp
import aiohttp
import asyncio
import async_timeoutclass PageAsync(object):
async def fetch(session, url):
with async_timeout.timeout(10):
async with session.get(url) as response:
return await response.text()async def main(loop):
async with aiohttp.ClientSession(loop=loop) as session:
html = await PageAsync.fetch(session, 'https://www.tiket.com/')
return htmlloop = asyncio.get_event_loop()
response = loop.run_until_complete(PageAsync.main(loop))
print(response)
documentation aiohttp : http://aiohttp.readthedocs.io/en/stable/