reverse-api-engineer 0.1.0__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.
@@ -0,0 +1,86 @@
1
+ .DS_Store
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ develop-eggs/
9
+ dist/
10
+ downloads/
11
+ eggs/
12
+ .eggs/
13
+ lib/
14
+ lib64/
15
+ parts/
16
+ sdist/
17
+ var/
18
+ wheels/
19
+ share/python-wheels/
20
+ *.egg-info/
21
+ .installed.cfg
22
+ *.egg
23
+ MANIFEST
24
+ *.manifest
25
+ *.spec
26
+ pip-log.txt
27
+ pip-delete-this-directory.txt
28
+ htmlcov/
29
+ .tox/
30
+ .nox/
31
+ .coverage
32
+ .coverage.*
33
+ .cache
34
+ nosetests.xml
35
+ coverage.xml
36
+ *.cover
37
+ *.py,cover
38
+ .hypothesis/
39
+ .pytest_cache/
40
+ cover/
41
+ *.mo
42
+ *.pot
43
+ *.log
44
+ local_settings.py
45
+ db.sqlite3
46
+ db.sqlite3-journal
47
+ instance/
48
+ .webassets-cache
49
+ .scrapy
50
+ docs/_build/
51
+ .pybuilder/
52
+ target/
53
+ .ipynb_checkpoints
54
+ profile_default/
55
+ ipython_config.py
56
+ __pypackages__/
57
+ celerybeat-schedule
58
+ celerybeat.pid
59
+ *.sage.py
60
+ .env
61
+ .venv
62
+ env/
63
+ venv/
64
+ ENV/
65
+ env.bak/
66
+ venv.bak/
67
+ .spyderproject
68
+ .spyproject
69
+ .ropeproject
70
+ /site
71
+ .mypy_cache/
72
+ .dmypy.json
73
+ dmypy.json
74
+ .pyre/
75
+ .pytype/
76
+ cython_debug/
77
+
78
+ # Project specific
79
+ har/
80
+ scripts/
81
+ scripts_built/
82
+ !scripts/*/api_client.py
83
+ !scripts/*/example_usage.py
84
+ !scripts/*/README.md
85
+ .reverse-api/
86
+ *.har
@@ -0,0 +1 @@
1
+ 3.13
@@ -0,0 +1,47 @@
1
+ # Contributing to Reverse API
2
+
3
+ Thank you for your interest in contributing to Reverse API! This document provides guidelines and instructions for contributing.
4
+
5
+ ## Development Setup
6
+
7
+ 1. **Fork and clone the repository**
8
+ ```bash
9
+ git clone https://github.com/kalil0321/reverse-api-engineer.git
10
+ cd reverse-api-engineer
11
+ ```
12
+
13
+ 2. **Install dependencies**
14
+ ```bash
15
+ uv sync
16
+ playwright install chromium
17
+ ```
18
+
19
+ 3. **Run locally**
20
+ ```bash
21
+ uv run reverse-api-engineer
22
+ ```
23
+
24
+ ## Code Style
25
+
26
+ - Follow PEP 8 guidelines
27
+ - Use type hints where applicable
28
+ - Add docstrings to functions and classes
29
+ - Keep the minimalist CLI aesthetic
30
+
31
+ ## Pull Request Process
32
+
33
+ 1. Create a feature branch from `main`
34
+ 2. Make your changes
35
+ 3. Test your changes locally
36
+ 4. Submit a pull request with a clear description
37
+
38
+ ## Reporting Issues
39
+
40
+ - Use the GitHub issue tracker
41
+ - Include steps to reproduce
42
+ - Provide system information (OS, Python version)
43
+ - Include error messages and logs
44
+
45
+ ## Questions?
46
+
47
+ Feel free to open an issue for any questions or suggestions!
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 kalil0321
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,212 @@
1
+ Metadata-Version: 2.4
2
+ Name: reverse-api-engineer
3
+ Version: 0.1.0
4
+ Summary: A tool to capture browser traffic for API reverse engineering
5
+ Project-URL: Homepage, https://github.com/kalil0321/reverse-api-engineer
6
+ Project-URL: Repository, https://github.com/kalil0321/reverse-api-engineer
7
+ Project-URL: Issues, https://github.com/kalil0321/reverse-api-engineer/issues
8
+ Author-email: Kalil <kalil0321@users.noreply.github.com>
9
+ License: MIT
10
+ License-File: LICENSE
11
+ Keywords: api,browser,claude,har,playwright,reverse-engineering
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Internet :: WWW/HTTP
21
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
+ Requires-Python: >=3.10
23
+ Requires-Dist: anthropic>=0.40.0
24
+ Requires-Dist: brotli>=1.2.0
25
+ Requires-Dist: claude-agent-sdk>=0.1.0
26
+ Requires-Dist: click>=8.1.0
27
+ Requires-Dist: playwright-stealth>=1.0.0
28
+ Requires-Dist: playwright>=1.40.0
29
+ Requires-Dist: questionary>=2.0.0
30
+ Requires-Dist: requests>=2.32.5
31
+ Requires-Dist: rich>=13.0.0
32
+ Description-Content-Type: text/markdown
33
+
34
+ # 🔄 Reverse API Engineer
35
+
36
+ [![PyPI version](https://badge.fury.io/py/reverse-api-engineer.svg)](https://badge.fury.io/py/reverse-api-engineer)
37
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
38
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
39
+
40
+ **Reverse API** is an AI-powered tool that captures browser traffic and automatically generates production-ready Python API clients. No more manual reverse engineering—just browse, capture, and get clean API code.
41
+
42
+ ## ✨ Features
43
+
44
+ - 🌐 **Browser Automation**: Built on Playwright with stealth mode for realistic browsing
45
+ - 📊 **HAR Recording**: Captures all network traffic in HTTP Archive format
46
+ - 🤖 **AI-Powered Generation**: Uses Claude 4.5 to analyze traffic and generate clean Python code
47
+ - 💻 **Interactive CLI**: Minimalist terminal interface with mode cycling (Shift+Tab)
48
+ - 📦 **Production Ready**: Generated scripts include error handling, type hints, and documentation
49
+ - 💾 **Session History**: All runs saved locally with full message logs
50
+ - 💰 **Cost Tracking**: Detailed token usage and cost estimation with cache support
51
+
52
+ ## 🚀 Installation
53
+
54
+ ### Using pip
55
+ ```bash
56
+ pip install reverse-api-engineer
57
+ ```
58
+
59
+ ### Using uv (recommended)
60
+ ```bash
61
+ uv tool install reverse-api-engineer
62
+ ```
63
+
64
+ ### From source
65
+ ```bash
66
+ git clone https://github.com/kalil0321/reverse-api-engineer.git
67
+ cd reverse-api-engineer
68
+ uv sync
69
+ ```
70
+
71
+ ### Post-installation
72
+ Install Playwright browsers:
73
+ ```bash
74
+ playwright install chromium
75
+ ```
76
+
77
+ ## 📖 Usage
78
+
79
+ ### Quick Start
80
+
81
+ Launch the interactive CLI:
82
+ ```bash
83
+ reverse-api-engineer
84
+ ```
85
+
86
+ The CLI has two modes (cycle with **Shift+Tab**):
87
+ - **manual**: Full pipeline (browser capture + AI generation)
88
+ - **engineer**: Reverse engineer from existing run_id
89
+
90
+ ### Manual Mode (Full Pipeline)
91
+
92
+ 1. Start the CLI: `reverse-api-engineer`
93
+ 2. Enter your task description (e.g., "Fetch Apple job listings")
94
+ 3. Optionally provide a starting URL
95
+ 4. Browse and interact with the website
96
+ 5. Close the browser when done
97
+ 6. AI automatically generates the API client
98
+
99
+ Generated scripts are saved to:
100
+ - `~/.reverse-api/runs/scripts/{run_id}/` (permanent storage)
101
+ - `./scripts/{descriptive_name}/` (local copy with readable name)
102
+
103
+ ### Engineer Mode (Re-process existing captures)
104
+
105
+ Re-run AI generation on a previous capture:
106
+ ```bash
107
+ # In CLI, switch to engineer mode (Shift+Tab) and enter run_id
108
+ # Or use command line:
109
+ reverse-api-engineer engineer <run_id>
110
+ ```
111
+
112
+ ### CLI Commands
113
+
114
+ While in the CLI, use these slash commands:
115
+ - `/settings` - Configure model and output directory
116
+ - `/history` - View past runs with costs
117
+ - `/messages <run_id>` - View detailed message logs
118
+ - `/help` - Show all commands
119
+ - `/exit` - Quit
120
+
121
+ ### Model Selection
122
+
123
+ Choose from Claude 4.5 models:
124
+ - **Sonnet 4.5** (default): Balanced performance and cost
125
+ - **Opus 4.5**: Maximum capability for complex APIs
126
+ - **Haiku 4.5**: Fastest and most economical
127
+
128
+ Change model in `/settings` or via CLI:
129
+ ```bash
130
+ reverse-api-engineer manual --model claude-sonnet-4-5
131
+ ```
132
+
133
+ ## 🔧 Configuration
134
+
135
+ Settings are stored in `~/.reverse-api/config.json`:
136
+ ```json
137
+ {
138
+ "model": "claude-sonnet-4-5",
139
+ "output_dir": null
140
+ }
141
+ ```
142
+
143
+ ## 📁 Project Structure
144
+
145
+ ```
146
+ ~/.reverse-api/
147
+ ├── config.json # User settings
148
+ ├── history.json # Run history with metadata
149
+ └── runs/
150
+ ├── har/{run_id}/ # Captured HAR files
151
+ ├── scripts/{run_id}/ # Generated API clients
152
+ └── messages/{run_id}.jsonl # Full message logs
153
+ ```
154
+
155
+ ## 💡 Examples
156
+
157
+ ### Example: Reverse Engineering a Job Board API
158
+
159
+ ```bash
160
+ $ reverse-api-engineer
161
+ > fetch all apple jobs from their careers page
162
+
163
+ # Browser opens, you navigate and interact
164
+ # Close browser when done
165
+
166
+ # AI generates:
167
+ # - api_client.py (full API implementation)
168
+ # - README.md (documentation)
169
+ # - example_usage.py (usage examples)
170
+
171
+ # Scripts copied to: ./scripts/apple_jobs_api/
172
+ ```
173
+
174
+ Generated `api_client.py` includes:
175
+ - Authentication handling
176
+ - Clean function interfaces
177
+ - Type hints and docstrings
178
+ - Error handling
179
+ - Production-ready code
180
+
181
+ ## 🛠️ Development
182
+
183
+ ### Setup
184
+ ```bash
185
+ git clone https://github.com/kalil0321/reverse-api-engineer.git
186
+ cd reverse-api-engineer
187
+ uv sync
188
+ ```
189
+
190
+ ### Run locally
191
+ ```bash
192
+ uv run reverse-api-engineer
193
+ ```
194
+
195
+ ### Build
196
+ ```bash
197
+ uv build
198
+ ```
199
+
200
+ ## 🔐 Requirements
201
+
202
+ - Python 3.10+
203
+ - Anthropic API key (set as `ANTHROPIC_API_KEY` environment variable)
204
+ - Playwright browsers installed
205
+
206
+ ## 🤝 Contributing
207
+
208
+ Contributions are welcome! Please feel free to submit a Pull Request.
209
+
210
+ ## 📄 License
211
+
212
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
@@ -0,0 +1,179 @@
1
+ # 🔄 Reverse API Engineer
2
+
3
+ [![PyPI version](https://badge.fury.io/py/reverse-api-engineer.svg)](https://badge.fury.io/py/reverse-api-engineer)
4
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
+
7
+ **Reverse API** is an AI-powered tool that captures browser traffic and automatically generates production-ready Python API clients. No more manual reverse engineering—just browse, capture, and get clean API code.
8
+
9
+ ## ✨ Features
10
+
11
+ - 🌐 **Browser Automation**: Built on Playwright with stealth mode for realistic browsing
12
+ - 📊 **HAR Recording**: Captures all network traffic in HTTP Archive format
13
+ - 🤖 **AI-Powered Generation**: Uses Claude 4.5 to analyze traffic and generate clean Python code
14
+ - 💻 **Interactive CLI**: Minimalist terminal interface with mode cycling (Shift+Tab)
15
+ - 📦 **Production Ready**: Generated scripts include error handling, type hints, and documentation
16
+ - 💾 **Session History**: All runs saved locally with full message logs
17
+ - 💰 **Cost Tracking**: Detailed token usage and cost estimation with cache support
18
+
19
+ ## 🚀 Installation
20
+
21
+ ### Using pip
22
+ ```bash
23
+ pip install reverse-api-engineer
24
+ ```
25
+
26
+ ### Using uv (recommended)
27
+ ```bash
28
+ uv tool install reverse-api-engineer
29
+ ```
30
+
31
+ ### From source
32
+ ```bash
33
+ git clone https://github.com/kalil0321/reverse-api-engineer.git
34
+ cd reverse-api-engineer
35
+ uv sync
36
+ ```
37
+
38
+ ### Post-installation
39
+ Install Playwright browsers:
40
+ ```bash
41
+ playwright install chromium
42
+ ```
43
+
44
+ ## 📖 Usage
45
+
46
+ ### Quick Start
47
+
48
+ Launch the interactive CLI:
49
+ ```bash
50
+ reverse-api-engineer
51
+ ```
52
+
53
+ The CLI has two modes (cycle with **Shift+Tab**):
54
+ - **manual**: Full pipeline (browser capture + AI generation)
55
+ - **engineer**: Reverse engineer from existing run_id
56
+
57
+ ### Manual Mode (Full Pipeline)
58
+
59
+ 1. Start the CLI: `reverse-api-engineer`
60
+ 2. Enter your task description (e.g., "Fetch Apple job listings")
61
+ 3. Optionally provide a starting URL
62
+ 4. Browse and interact with the website
63
+ 5. Close the browser when done
64
+ 6. AI automatically generates the API client
65
+
66
+ Generated scripts are saved to:
67
+ - `~/.reverse-api/runs/scripts/{run_id}/` (permanent storage)
68
+ - `./scripts/{descriptive_name}/` (local copy with readable name)
69
+
70
+ ### Engineer Mode (Re-process existing captures)
71
+
72
+ Re-run AI generation on a previous capture:
73
+ ```bash
74
+ # In CLI, switch to engineer mode (Shift+Tab) and enter run_id
75
+ # Or use command line:
76
+ reverse-api-engineer engineer <run_id>
77
+ ```
78
+
79
+ ### CLI Commands
80
+
81
+ While in the CLI, use these slash commands:
82
+ - `/settings` - Configure model and output directory
83
+ - `/history` - View past runs with costs
84
+ - `/messages <run_id>` - View detailed message logs
85
+ - `/help` - Show all commands
86
+ - `/exit` - Quit
87
+
88
+ ### Model Selection
89
+
90
+ Choose from Claude 4.5 models:
91
+ - **Sonnet 4.5** (default): Balanced performance and cost
92
+ - **Opus 4.5**: Maximum capability for complex APIs
93
+ - **Haiku 4.5**: Fastest and most economical
94
+
95
+ Change model in `/settings` or via CLI:
96
+ ```bash
97
+ reverse-api-engineer manual --model claude-sonnet-4-5
98
+ ```
99
+
100
+ ## 🔧 Configuration
101
+
102
+ Settings are stored in `~/.reverse-api/config.json`:
103
+ ```json
104
+ {
105
+ "model": "claude-sonnet-4-5",
106
+ "output_dir": null
107
+ }
108
+ ```
109
+
110
+ ## 📁 Project Structure
111
+
112
+ ```
113
+ ~/.reverse-api/
114
+ ├── config.json # User settings
115
+ ├── history.json # Run history with metadata
116
+ └── runs/
117
+ ├── har/{run_id}/ # Captured HAR files
118
+ ├── scripts/{run_id}/ # Generated API clients
119
+ └── messages/{run_id}.jsonl # Full message logs
120
+ ```
121
+
122
+ ## 💡 Examples
123
+
124
+ ### Example: Reverse Engineering a Job Board API
125
+
126
+ ```bash
127
+ $ reverse-api-engineer
128
+ > fetch all apple jobs from their careers page
129
+
130
+ # Browser opens, you navigate and interact
131
+ # Close browser when done
132
+
133
+ # AI generates:
134
+ # - api_client.py (full API implementation)
135
+ # - README.md (documentation)
136
+ # - example_usage.py (usage examples)
137
+
138
+ # Scripts copied to: ./scripts/apple_jobs_api/
139
+ ```
140
+
141
+ Generated `api_client.py` includes:
142
+ - Authentication handling
143
+ - Clean function interfaces
144
+ - Type hints and docstrings
145
+ - Error handling
146
+ - Production-ready code
147
+
148
+ ## 🛠️ Development
149
+
150
+ ### Setup
151
+ ```bash
152
+ git clone https://github.com/kalil0321/reverse-api-engineer.git
153
+ cd reverse-api-engineer
154
+ uv sync
155
+ ```
156
+
157
+ ### Run locally
158
+ ```bash
159
+ uv run reverse-api-engineer
160
+ ```
161
+
162
+ ### Build
163
+ ```bash
164
+ uv build
165
+ ```
166
+
167
+ ## 🔐 Requirements
168
+
169
+ - Python 3.10+
170
+ - Anthropic API key (set as `ANTHROPIC_API_KEY` environment variable)
171
+ - Playwright browsers installed
172
+
173
+ ## 🤝 Contributing
174
+
175
+ Contributions are welcome! Please feel free to submit a Pull Request.
176
+
177
+ ## 📄 License
178
+
179
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
@@ -0,0 +1,52 @@
1
+ [project]
2
+ name = "reverse-api-engineer"
3
+ version = "0.1.0"
4
+ description = "A tool to capture browser traffic for API reverse engineering"
5
+ readme = "README.md"
6
+ requires-python = ">=3.10"
7
+ authors = [
8
+ { name = "Kalil", email = "kalil0321@users.noreply.github.com" }
9
+ ]
10
+ license = { text = "MIT" }
11
+ keywords = ["api", "reverse-engineering", "browser", "har", "playwright", "claude"]
12
+ classifiers = [
13
+ "Development Status :: 3 - Alpha",
14
+ "Intended Audience :: Developers",
15
+ "License :: OSI Approved :: MIT License",
16
+ "Programming Language :: Python :: 3",
17
+ "Programming Language :: Python :: 3.10",
18
+ "Programming Language :: Python :: 3.11",
19
+ "Programming Language :: Python :: 3.12",
20
+ "Programming Language :: Python :: 3.13",
21
+ "Topic :: Software Development :: Libraries :: Python Modules",
22
+ "Topic :: Internet :: WWW/HTTP",
23
+ ]
24
+ dependencies = [
25
+ "playwright>=1.40.0",
26
+ "playwright-stealth>=1.0.0",
27
+ "click>=8.1.0",
28
+ "claude-agent-sdk>=0.1.0",
29
+ "rich>=13.0.0",
30
+ "questionary>=2.0.0",
31
+ "requests>=2.32.5",
32
+ "anthropic>=0.40.0",
33
+ "brotli>=1.2.0",
34
+ ]
35
+
36
+ [project.urls]
37
+ Homepage = "https://github.com/kalil0321/reverse-api-engineer"
38
+ Repository = "https://github.com/kalil0321/reverse-api-engineer"
39
+ Issues = "https://github.com/kalil0321/reverse-api-engineer/issues"
40
+
41
+ [project.scripts]
42
+ reverse-api-engineer = "reverse_api.cli:main"
43
+
44
+ [build-system]
45
+ requires = ["hatchling"]
46
+ build-backend = "hatchling.build"
47
+
48
+ [tool.hatch.build.targets.wheel]
49
+ packages = ["src/reverse_api"]
50
+
51
+ [dependency-groups]
52
+ dev = []