httpdbg 1.2.4__tar.gz → 1.2.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {httpdbg-1.2.4 → httpdbg-1.2.5}/PKG-INFO +1 -1
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/__init__.py +1 -1
- httpdbg-1.2.5/httpdbg/hooks/all.py +61 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/hooks/template_sitecustomize.py +18 -4
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg.egg-info/PKG-INFO +1 -1
- httpdbg-1.2.4/httpdbg/hooks/all.py +0 -53
- {httpdbg-1.2.4 → httpdbg-1.2.5}/LICENSE +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/README.md +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/__main__.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/args.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/env.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/exception.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/hooks/__init__.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/hooks/aiohttp.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/hooks/external.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/hooks/fastapi.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/hooks/flask.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/hooks/generic.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/hooks/http.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/hooks/httpx.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/hooks/pytest.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/hooks/requests.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/hooks/socket.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/hooks/starlette.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/hooks/unittest.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/hooks/urllib3.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/hooks/utils.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/hooks/uvicorn.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/initiator.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/log.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/mode_console.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/mode_module.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/mode_script.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/preview.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/records.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/server.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/utils.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/webapp/__init__.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/webapp/api.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/webapp/app.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/webapp/static/api.js +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/webapp/static/column.css +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/webapp/static/configuration.css +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/webapp/static/configuration.js +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/webapp/static/detail.css +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/webapp/static/favicon.ico +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/webapp/static/filter.js +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/webapp/static/icons/chevron-direction-top-outline-icon.svg +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/webapp/static/icons/download-install-line-icon.svg +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/webapp/static/icons/engine-gears-icon.svg +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/webapp/static/icons/eye-blind-icon.svg +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/webapp/static/icons/eye-icon.svg +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/webapp/static/icons/files-papers-outline-icon.svg +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/webapp/static/icons/filter-outline-icon.svg +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/webapp/static/icons/information-mark-circle-outline-icon.svg +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/webapp/static/icons/lock-line-icon.svg +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/webapp/static/icons/lock-open-line-icon.svg +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/webapp/static/icons/math-multiplication-icon.svg +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/webapp/static/icons/push-pin-green-icon.svg +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/webapp/static/icons/question-mark-round-line-icon.svg +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/webapp/static/icons/recycle-bin-line-icon.svg +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/webapp/static/icons/wait-sandclock-icon.svg +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/webapp/static/index.htm +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/webapp/static/main.js +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/webapp/static/mustache.min.js +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/webapp/static/render.js +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/webapp/static/style.css +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/webapp/static/table.css +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg.egg-info/SOURCES.txt +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg.egg-info/dependency_links.txt +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg.egg-info/entry_points.txt +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg.egg-info/top_level.txt +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/pyproject.toml +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/setup.cfg +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/tests/test_api.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/tests/test_cli.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/tests/test_context_manager.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/tests/test_hook_aiohttp.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/tests/test_hook_httpx.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/tests/test_hook_pytest.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/tests/test_hook_requests.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/tests/test_hook_unittest.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/tests/test_hook_urllib3.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/tests/test_initiator.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/tests/test_mode_console.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/tests/test_mode_module_pytest.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/tests/test_mode_script.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/tests/test_multiprocess.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/tests/test_preview.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/tests/test_pyhttpdbg_server.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/tests/test_server.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/tests/test_server_hook_fastapi.py +0 -0
- {httpdbg-1.2.4 → httpdbg-1.2.5}/tests/test_server_hook_flask.py +0 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
from contextlib import contextmanager
|
|
3
|
+
from typing import Generator
|
|
4
|
+
from typing import List
|
|
5
|
+
from typing import Tuple
|
|
6
|
+
from typing import Union
|
|
7
|
+
|
|
8
|
+
from httpdbg.hooks.aiohttp import hook_aiohttp
|
|
9
|
+
from httpdbg.hooks.external import watcher_external
|
|
10
|
+
from httpdbg.hooks.fastapi import hook_fastapi
|
|
11
|
+
from httpdbg.hooks.flask import hook_flask
|
|
12
|
+
from httpdbg.hooks.generic import hook_generic
|
|
13
|
+
from httpdbg.hooks.http import hook_http
|
|
14
|
+
from httpdbg.hooks.httpx import hook_httpx
|
|
15
|
+
from httpdbg.hooks.pytest import hook_pytest
|
|
16
|
+
from httpdbg.hooks.requests import hook_requests
|
|
17
|
+
from httpdbg.hooks.socket import hook_socket
|
|
18
|
+
from httpdbg.hooks.starlette import hook_starlette
|
|
19
|
+
from httpdbg.hooks.unittest import hook_unittest
|
|
20
|
+
from httpdbg.hooks.urllib3 import hook_urllib3
|
|
21
|
+
from httpdbg.hooks.uvicorn import hook_uvicorn
|
|
22
|
+
|
|
23
|
+
from httpdbg.records import HTTPRecords
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@contextmanager
|
|
27
|
+
def httprecord(
|
|
28
|
+
records: HTTPRecords = None,
|
|
29
|
+
initiators: Union[List[str], None] = None,
|
|
30
|
+
client: bool = True,
|
|
31
|
+
server: bool = False,
|
|
32
|
+
ignore: Union[List[Tuple[str, int]], None] = None,
|
|
33
|
+
multiprocess: bool = True,
|
|
34
|
+
) -> Generator[HTTPRecords, None, None]:
|
|
35
|
+
if records is None:
|
|
36
|
+
records = HTTPRecords(client=client, server=server, ignore=ignore)
|
|
37
|
+
|
|
38
|
+
with hook_flask(records):
|
|
39
|
+
with hook_socket(records):
|
|
40
|
+
with hook_fastapi(records):
|
|
41
|
+
with hook_starlette(records):
|
|
42
|
+
with hook_uvicorn(records):
|
|
43
|
+
with hook_http(records):
|
|
44
|
+
with hook_httpx(records):
|
|
45
|
+
with hook_requests(records):
|
|
46
|
+
with hook_urllib3(records):
|
|
47
|
+
with hook_aiohttp(records):
|
|
48
|
+
with hook_pytest(records):
|
|
49
|
+
with hook_unittest(records):
|
|
50
|
+
with hook_generic(
|
|
51
|
+
records, initiators
|
|
52
|
+
):
|
|
53
|
+
if multiprocess:
|
|
54
|
+
with watcher_external(
|
|
55
|
+
records,
|
|
56
|
+
initiators,
|
|
57
|
+
server,
|
|
58
|
+
):
|
|
59
|
+
yield records
|
|
60
|
+
else:
|
|
61
|
+
yield records
|
|
@@ -7,8 +7,10 @@ import threading
|
|
|
7
7
|
from typing import Union
|
|
8
8
|
import uuid
|
|
9
9
|
|
|
10
|
-
from httpdbg.hooks.all import httprecord
|
|
11
10
|
from httpdbg import HTTPRecords
|
|
11
|
+
from httpdbg.env import HTTPDBG_MULTIPROCESS_DIR
|
|
12
|
+
from httpdbg.hooks.all import httprecord
|
|
13
|
+
from httpdbg.log import logger
|
|
12
14
|
|
|
13
15
|
HTTPDBG_INITIATORS = [] # type: ignore
|
|
14
16
|
HTTPDBG_RECORD_SERVER = False
|
|
@@ -20,14 +22,26 @@ class HttpdbgRecorder:
|
|
|
20
22
|
def __init__(self):
|
|
21
23
|
self._running: bool = False
|
|
22
24
|
self.fname: str = os.path.join(
|
|
23
|
-
os.environ[
|
|
25
|
+
os.environ[HTTPDBG_MULTIPROCESS_DIR], str(uuid.uuid1())
|
|
24
26
|
)
|
|
25
27
|
self.context = None
|
|
26
28
|
self.records: Union[HTTPRecords, None] = None
|
|
27
29
|
|
|
28
30
|
def _save_to_disk_loop(self):
|
|
29
31
|
while self._running:
|
|
30
|
-
|
|
32
|
+
try:
|
|
33
|
+
self.save_to_disk()
|
|
34
|
+
except RuntimeError as ex:
|
|
35
|
+
if "dictionary changed size during iteration" in str(ex):
|
|
36
|
+
# This happens because some new requests are recorded (or existing ones updated) while
|
|
37
|
+
# trying to save the HTTPRecords object on the disk to share it with the main process.
|
|
38
|
+
# Here we can ignore that exception, because this is only a best effort attempt to refresh
|
|
39
|
+
# the web interface. A last save is done before to exit the process.
|
|
40
|
+
logger().info(
|
|
41
|
+
"MultiProcess - _save_to_disk_loop - RuntimeError - dictionary changed size during iteration"
|
|
42
|
+
)
|
|
43
|
+
else:
|
|
44
|
+
raise
|
|
31
45
|
time.sleep(1)
|
|
32
46
|
|
|
33
47
|
def save_to_disk(self):
|
|
@@ -58,7 +72,7 @@ class HttpdbgRecorder:
|
|
|
58
72
|
self.context.__exit__(None, None, None)
|
|
59
73
|
|
|
60
74
|
|
|
61
|
-
if
|
|
75
|
+
if HTTPDBG_MULTIPROCESS_DIR in os.environ:
|
|
62
76
|
|
|
63
77
|
if not hasattr(sys, "_httpdbg_enabled"):
|
|
64
78
|
sys._httpdbg_enabled = True # type: ignore[attr-defined]
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
from contextlib import contextmanager
|
|
3
|
-
from typing import Generator
|
|
4
|
-
from typing import List
|
|
5
|
-
from typing import Tuple
|
|
6
|
-
from typing import Union
|
|
7
|
-
|
|
8
|
-
from httpdbg.hooks.aiohttp import hook_aiohttp
|
|
9
|
-
from httpdbg.hooks.external import watcher_external
|
|
10
|
-
from httpdbg.hooks.fastapi import hook_fastapi
|
|
11
|
-
from httpdbg.hooks.flask import hook_flask
|
|
12
|
-
from httpdbg.hooks.generic import hook_generic
|
|
13
|
-
from httpdbg.hooks.http import hook_http
|
|
14
|
-
from httpdbg.hooks.httpx import hook_httpx
|
|
15
|
-
from httpdbg.hooks.pytest import hook_pytest
|
|
16
|
-
from httpdbg.hooks.requests import hook_requests
|
|
17
|
-
from httpdbg.hooks.socket import hook_socket
|
|
18
|
-
from httpdbg.hooks.starlette import hook_starlette
|
|
19
|
-
from httpdbg.hooks.unittest import hook_unittest
|
|
20
|
-
from httpdbg.hooks.urllib3 import hook_urllib3
|
|
21
|
-
from httpdbg.hooks.uvicorn import hook_uvicorn
|
|
22
|
-
|
|
23
|
-
from httpdbg.records import HTTPRecords
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
@contextmanager
|
|
27
|
-
def httprecord(
|
|
28
|
-
records: HTTPRecords = None,
|
|
29
|
-
initiators: Union[List[str], None] = None,
|
|
30
|
-
client: bool = True,
|
|
31
|
-
server: bool = False,
|
|
32
|
-
ignore: Union[List[Tuple[str, int]], None] = None,
|
|
33
|
-
) -> Generator[HTTPRecords, None, None]:
|
|
34
|
-
if records is None:
|
|
35
|
-
records = HTTPRecords(client=client, server=server, ignore=ignore)
|
|
36
|
-
|
|
37
|
-
with watcher_external(records, initiators, server):
|
|
38
|
-
with hook_flask(records):
|
|
39
|
-
with hook_socket(records):
|
|
40
|
-
with hook_fastapi(records):
|
|
41
|
-
with hook_starlette(records):
|
|
42
|
-
with hook_uvicorn(records):
|
|
43
|
-
with hook_http(records):
|
|
44
|
-
with hook_httpx(records):
|
|
45
|
-
with hook_requests(records):
|
|
46
|
-
with hook_urllib3(records):
|
|
47
|
-
with hook_aiohttp(records):
|
|
48
|
-
with hook_pytest(records):
|
|
49
|
-
with hook_unittest(records):
|
|
50
|
-
with hook_generic(
|
|
51
|
-
records, initiators
|
|
52
|
-
):
|
|
53
|
-
yield records
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/webapp/static/icons/chevron-direction-top-outline-icon.svg
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/webapp/static/icons/information-mark-circle-outline-icon.svg
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{httpdbg-1.2.4 → httpdbg-1.2.5}/httpdbg/webapp/static/icons/question-mark-round-line-icon.svg
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|