Lesson 05
OOP, async, and HTTP
Compose robust programs with classes, concurrency, and reliable API calls.
Classes & dataclasses
from dataclasses import dataclass
@dataclass
class Quote:
symbol: str
price: float
q = Quote("SIG", 12.34)
print(q) # Quote(symbol='SIG', price=12.34)
print(q.symbol)
Async/await
import asyncio
async def work(n: int):
await asyncio.sleep(1)
return n * n
async def main():
results = await asyncio.gather(*(work(i) for i in range(3)))
print(results)
asyncio.run(main())
HTTP requests
import requests
resp = requests.get("https://httpbin.org/json", timeout=5)
resp.raise_for_status()
data = resp.json()
print(data.get("slideshow", {}).get("title"))
Accelerate with SigLabs Financial Software
Forecasting, market screening, risk insights, and reporting—built for speed and clarity.
Wrap up
You’ve completed the core Python track. Explore more on the homepage or try our software.