{"library":"pook","title":"pook - HTTP traffic mocking","description":"pook is an HTTP traffic mocking library for Python, enabling easy setup of expectations and interception of requests from popular HTTP clients like `requests`, `httpx`, and `aiohttp`. It supports various matching criteria for requests and provides flexible response definitions. The current version is 2.1.6, and it typically sees several patch releases per major version, though releases can sometimes be delayed.","language":"python","status":"active","last_verified":"Mon May 18","install":{"commands":["pip install pook"],"cli":null},"imports":["import pook","import pook\n\n@pook.on","import pook\n\nwith pook.use():"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import pook\nimport requests\nimport os\n\n# Configure a mock for a GET request\npook.get('https://api.example.com/data', reply=200, response_json={'status': 'ok', 'data': [1, 2, 3]})\n\n# Activate pook (can also use @pook.on decorator or with pook.use():)\npook.activate()\n\ntry:\n    # Make a request using requests, which pook will intercept\n    response = requests.get('https://api.example.com/data')\n\n    print(f\"Status Code: {response.status_code}\")\n    print(f\"Response JSON: {response.json()}\")\n\n    assert response.status_code == 200\n    assert response.json() == {'status': 'ok', 'data': [1, 2, 3]}\n\nfinally:\n    # Always deactivate pook and clear mocks to avoid leakage\n    pook.off()\n    pook.flush()\n","lang":"python","description":"This quickstart demonstrates how to mock an HTTP GET request using `pook` with the `requests` library. It sets up an expectation for a specific URL, activates the mock, makes the request, and then asserts the mocked response. Remember to deactivate and flush mocks to prevent state leakage between tests.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-18","installed_version":"2.1.4","pypi_latest":"2.1.6","is_stale":true,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":2.6,"avg_import_s":0.75,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"pook","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.62,"mem_mb":15,"disk_size":"22.5M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"pook","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":2.7,"import_time_s":0.44,"mem_mb":15,"disk_size":"23M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"pook","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.81,"mem_mb":16.2,"disk_size":"24.8M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"pook","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":2.5,"import_time_s":0.67,"mem_mb":16.2,"disk_size":"25M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"pook","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":1.01,"mem_mb":16,"disk_size":"16.6M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"pook","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":2.3,"import_time_s":0.93,"mem_mb":16,"disk_size":"17M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"pook","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":1.01,"mem_mb":16.6,"disk_size":"16.0M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"pook","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":2.2,"import_time_s":0.88,"mem_mb":16.6,"disk_size":"16M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"pook","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.6,"mem_mb":15.8,"disk_size":"22.0M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"pook","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":3.1,"import_time_s":0.52,"mem_mb":15.8,"disk_size":"22M"}]}}