Changelog:
- 2024-07-15: updated to support recent HTTPX versions, based on @karpetrosyan's comment.
- 2021-01 (ish): initial version
An HTTPCore transport that uses urllib3 as the HTTP networking backend. (This was initially shipped with HTTPX.)
| """ | |
| Bayes rule, reframed as "odds" instead of "chances". | |
| https://twitter.com/florimondmanca/status/1342119381573238789 | |
| Inspired by 3Blue1Brown's "The medical test paradox: Can redesigning Bayes rule help?". | |
| """ | |
| from fractions import Fraction | |
| from typing import Any |
| from opentelemetry.instrumentation import httpx_client as httpx_opentelemetry | |
| async def main(): | |
| opentelemetry_on_request, opentelemetry_on_response = httpx_opentelemetry.create_async_hooks() | |
| event_hooks = { | |
| "request": [opentelemetry_on_request], | |
| "response": [opentelemetry_on_response] | |
| } |
| """ | |
| Example using the transport directly. | |
| """ | |
| import json | |
| from httpcore_uds import AsyncUDSTransport | |
| async def main() -> None: | |
| """ |
localhost:pip install trustme-cli
trustme-cliwrk on each endpoint, eg:A list of ASGI-related Python packages I maintain:
| import trio | |
| import contextvars | |
| LAST_TASK_ID = 0 | |
| TASK_ID: contextvars.ContextVar[str] = contextvars.ContextVar("task_id") | |
| async def producer(num_items: int, send_channel: trio.MemorySendChannel) -> None: | |
| task_id = TASK_ID.get() | |
| iden = f"Producer {task_id}" |
| import datetime | |
| import decimal | |
| import json | |
| from typing import Any, Optional, Type, Union, Dict, Tuple | |
| from pydantic import BaseModel, ValidationError, create_model | |
| from tortoise import fields as tortoise_fields | |
| from tortoise.fields import Field | |
| from tortoise.models import Model as TortoiseModel |
| """Script to run a stand-alone equivalent of Django's `makemigrations`.""" | |
| import sys | |
| import django | |
| from django.conf import settings | |
| from django.core.management import call_command | |
| def makemigrations(app_name: str): |
| /* Generate environment.ts file using environment variables | |
| Requires: | |
| npm install --save yargs | |
| npm install --save dotenv | |
| Usage: | |
| node set-env.js --env=dev | |
| Put variables in a local .env file so they can be |