A repository for exploring asynchronous programming in Python. This collection of examples demonstrates various concurrency models, ranging from simple synchronous HTTP requests to advanced async patterns using decorators, futures, and more.
Asynchronous programming enables you to write non-blocking, concurrent code using constructs like async/await
and event loops. It is ideal for I/O-bound tasks and improves the performance of network and parallel operations without relying solely on multi-threading or multi-processing.
These examples utilize several Python modules, including:
- Core Async Tools:
asyncio
- HTTP Clients:
aiohttp
,requests
- Concurrency:
threading
,multiprocessing
- Utilities:
time
,functools
,os
-
Synchronous Requests:
Simple HTTP requests using therequests
library. -
Threading & Multiprocessing:
Demonstrations of running tasks concurrently using threads and processes. -
Asyncio Basics:
Creating async functions, usingasyncio.sleep
, and managing tasks with the event loop. -
Advanced Async Techniques:
Handling timeouts, cancellation, and using custom decorators (e.g., for timing execution).
👤 Author: Piotr Lipinski
🗓 Date: March 2025
💬 Feedback: Contributions and suggestions are welcome!