webtap-tool 0.6.0__py3-none-any.whl → 0.7.0__py3-none-any.whl

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.

Potentially problematic release.


This version of webtap-tool might be problematic. Click here for more details.

webtap/commands/TIPS.md CHANGED
@@ -26,7 +26,7 @@ body(123, "msgpack.unpackb(body)") # Binary formats
26
26
  ```
27
27
 
28
28
  #### Tips
29
- - **Generate models:** `to_model({id}, "models/model.py")` - create Pydantic models from JSON
29
+ - **Generate models:** `to_model({id}, "models/model.py", "Model")` - create Pydantic models from JSON
30
30
  - **Chain requests:** `body({id}, "httpx.get(json.loads(body)['next_url']).text[:100]")`
31
31
  - **Parse XML:** `body({id}, "ElementTree.fromstring(body).find('.//title').text")`
32
32
  - **Extract forms:** `body({id}, "[f['action'] for f in bs4(body, 'html.parser').find_all('form')]")`
@@ -38,13 +38,14 @@ Generate Pydantic v2 models from JSON response bodies for reverse engineering AP
38
38
 
39
39
  #### Examples
40
40
  ```python
41
- to_model(123, "models/product.py") # Generate from full response
42
- to_model(123, "models/customer.py", json_path="Data[0]") # Extract nested object
43
- to_model(123, "/tmp/model.py", json_path="items") # Extract array items
41
+ to_model(123, "models/product.py", "Product") # Generate from full response
42
+ to_model(123, "models/customers/group.py", "CustomerGroup", "Data[0]") # Extract nested + domain structure
43
+ to_model(123, "/tmp/item.py", "Item", "items[0]") # Extract array items
44
44
  ```
45
45
 
46
46
  #### Tips
47
47
  - **Check structure first:** `body({id})` - preview JSON before generating
48
+ - **Domain organization:** Use paths like `"models/customers/group.py"` for structure
48
49
  - **Extract nested data:** Use `json_path="Data[0]"` to extract specific objects
49
50
  - **Array items:** Extract first item with `json_path="items[0]"` for model generation
50
51
  - **Auto-cleanup:** Generated models use snake_case fields and modern type hints (list, dict, | None)
@@ -80,7 +81,7 @@ Show network requests with full data.
80
81
 
81
82
  #### Tips
82
83
  - **Analyze responses:** `body({id})` - fetch response body
83
- - **Generate models:** `to_model({id}, "models/model.py")` - create Pydantic models from JSON
84
+ - **Generate models:** `to_model({id}, "models/model.py", "Model")` - create Pydantic models from JSON
84
85
  - **Parse HTML:** `body({id}, "bs4(body, 'html.parser').find('title').text")`
85
86
  - **Extract JSON:** `body({id}, "json.loads(body)['data']")`
86
87
  - **Find patterns:** `body({id}, "re.findall(r'/api/\\w+', body)")`
@@ -12,12 +12,13 @@ mcp_desc = get_mcp_description("to_model")
12
12
 
13
13
 
14
14
  @app.command(display="markdown", fastmcp={"type": "tool", "description": mcp_desc} if mcp_desc else {"type": "tool"})
15
- def to_model(state, response: int, output: str, json_path: str = None) -> dict: # pyright: ignore[reportArgumentType]
15
+ def to_model(state, response: int, output: str, model_name: str, json_path: str = None) -> dict: # pyright: ignore[reportArgumentType]
16
16
  """Generate Pydantic model from response body using datamodel-codegen.
17
17
 
18
18
  Args:
19
19
  response: Response row ID from network() table
20
- output: Output file path for generated model (e.g., "models/product.py")
20
+ output: Output file path for generated model (e.g., "models/customers/group.py")
21
+ model_name: Class name for generated model (e.g., "CustomerGroup")
21
22
  json_path: Optional JSON path to extract nested data (e.g., "Data[0]")
22
23
 
23
24
  Returns:
@@ -102,6 +103,7 @@ def to_model(state, response: int, output: str, json_path: str = None) -> dict:
102
103
  input_filename="response.json",
103
104
  output=output_path,
104
105
  output_model_type=DataModelType.PydanticV2BaseModel,
106
+ class_name=model_name, # Set generated class name
105
107
  snake_case_field=True, # Convert to snake_case
106
108
  use_standard_collections=True, # Use list instead of List
107
109
  use_union_operator=True, # Use | instead of Union
@@ -125,5 +127,10 @@ def to_model(state, response: int, output: str, json_path: str = None) -> dict:
125
127
 
126
128
  return success_response(
127
129
  "Model generated successfully",
128
- details={"Output": str(output_path), "Fields": field_count, "Size": f"{output_path.stat().st_size} bytes"},
130
+ details={
131
+ "Class": model_name,
132
+ "Output": str(output_path),
133
+ "Fields": field_count,
134
+ "Size": f"{output_path.stat().st_size} bytes",
135
+ },
129
136
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: webtap-tool
3
- Version: 0.6.0
3
+ Version: 0.7.0
4
4
  Summary: Terminal-based web page inspector for AI debugging sessions
5
5
  Author-email: Fredrik Angelsen <fredrikangelsen@gmail.com>
6
6
  Classifier: Development Status :: 3 - Alpha
@@ -11,7 +11,7 @@ webtap/cdp/schema/README.md,sha256=hnWCzbXYcYtWaZb_SgjVaFBiG81S9b9Y3x-euQFwQDo,1
11
11
  webtap/cdp/schema/cdp_protocol.json,sha256=dp9_OLYLuVsQb1oV5r6MZfMzURscBLyAXUckdaPWyv4,1488452
12
12
  webtap/cdp/schema/cdp_version.json,sha256=OhGy1qpfQjSe3Z7OqL6KynBFlDFBXxKGPZCY-ZN_lVU,399
13
13
  webtap/commands/DEVELOPER_GUIDE.md,sha256=LYOhycZ3k5EHx5nREfkjvLz7vOs8pXCRLlcDm-keWao,11973
14
- webtap/commands/TIPS.md,sha256=9zXJM6VjP23vdODpT6bjWd69uWAnhfs12KapK3Dd8H4,9126
14
+ webtap/commands/TIPS.md,sha256=XwnPKY5AgLsxNw3q0aF4Amr0P891Pt4QIkw0_3AF58g,9293
15
15
  webtap/commands/__init__.py,sha256=rr3xM_bY0BgxkDOjsnsI8UBhjlz7nqiYlgJ8fjiJ1jQ,270
16
16
  webtap/commands/_builders.py,sha256=SYacZmZTdkolQ7OOf3rFtFPCjkukY8z020WFA-i_O_A,7902
17
17
  webtap/commands/_tips.py,sha256=SleMpwdghrHNqdzR60Cu8T0NZqJfWfcfrgIcyWI6GIQ,4793
@@ -30,7 +30,7 @@ webtap/commands/network.py,sha256=gEOg_u7VF9A5aKv5myzLCuvfAUkF1OPxsuj4UAgbS44,31
30
30
  webtap/commands/selections.py,sha256=M001d_Gc51aSTuVeXGa19LDh2ZGR_qBJEjVGKpcGGFM,4895
31
31
  webtap/commands/server.py,sha256=DOcIgYuKp0ydwrK9EA3hGwqOwfwM9DABhdPu3hk_jjo,6948
32
32
  webtap/commands/setup.py,sha256=dov1LaN50nAEMNIuBLSK7mcnwhfn9rtqdTopBm1-PhA,9648
33
- webtap/commands/to_model.py,sha256=_KVGgptMkYSWgCTA9ekfAneIpwVeCcqIl6f9gwarYUQ,4719
33
+ webtap/commands/to_model.py,sha256=jOb93t616m5weT75VyF506J6nydDXUWENF7cpscbe9Q,4962
34
34
  webtap/services/README.md,sha256=rala_jtnNgSiQ1lFLM7x_UQ4SJZDceAm7dpkQMRTYaI,2346
35
35
  webtap/services/__init__.py,sha256=IjFqu0Ak6D-r18aokcQMtenDV3fbelvfjTCejGv6CZ0,570
36
36
  webtap/services/body.py,sha256=XQPa19y5eUc3XJ2TuwVK6kffO1VQoKqNs33MBBz7hzU,3913
@@ -45,7 +45,7 @@ webtap/services/setup/desktop.py,sha256=fXwQa201W-s2mengm_dJZ9BigJopVrO9YFUQcW_T
45
45
  webtap/services/setup/extension.py,sha256=iJY43JlQO6Vicgd9Mz6Mw0LQfbBNUGhnwI8n-LnvHBY,3602
46
46
  webtap/services/setup/filters.py,sha256=lAPSLMH_KZQO-7bRkmURwzforx7C3SDrKEw2ZogN-Lo,3220
47
47
  webtap/services/setup/platform.py,sha256=7yn-7LQFffgerWzWRtOG-yNEsR36ICThYUAu_N2FAso,4532
48
- webtap_tool-0.6.0.dist-info/METADATA,sha256=9a8cGzDHRhYnS-aamgu_IW5C3zCtY4pOVmbC-YDZucQ,17636
49
- webtap_tool-0.6.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
50
- webtap_tool-0.6.0.dist-info/entry_points.txt,sha256=iFe575I0CIb1MbfPt0oX2VYyY5gSU_dA551PKVR83TU,39
51
- webtap_tool-0.6.0.dist-info/RECORD,,
48
+ webtap_tool-0.7.0.dist-info/METADATA,sha256=JAfV9YTu10f5ss15yatHtYFx8W8HJewrPthMBS0TwN4,17636
49
+ webtap_tool-0.7.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
50
+ webtap_tool-0.7.0.dist-info/entry_points.txt,sha256=iFe575I0CIb1MbfPt0oX2VYyY5gSU_dA551PKVR83TU,39
51
+ webtap_tool-0.7.0.dist-info/RECORD,,