reverse-api-engineer 0.2.4__tar.gz → 0.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.
- reverse_api_engineer-0.2.5/.claude/settings.local.json +48 -0
- {reverse_api_engineer-0.2.4 → reverse_api_engineer-0.2.5}/.gitignore +3 -4
- {reverse_api_engineer-0.2.4 → reverse_api_engineer-0.2.5}/CHANGELOG.md +14 -0
- {reverse_api_engineer-0.2.4 → reverse_api_engineer-0.2.5}/PKG-INFO +1 -1
- {reverse_api_engineer-0.2.4 → reverse_api_engineer-0.2.5}/pyproject.toml +1 -1
- reverse_api_engineer-0.2.5/scripts/clean_build.sh +31 -0
- {reverse_api_engineer-0.2.4 → reverse_api_engineer-0.2.5}/src/reverse_api/opencode_engineer.py +5 -2
- reverse_api_engineer-0.2.4/.claude/settings.local.json +0 -24
- reverse_api_engineer-0.2.4/scripts/fetch_all_jobs/README.md +0 -463
- reverse_api_engineer-0.2.4/scripts/fetch_all_jobs/api_client.py +0 -856
- reverse_api_engineer-0.2.4/scripts/post_x/README.md +0 -237
- reverse_api_engineer-0.2.4/scripts/post_x/api_client.py +0 -376
- reverse_api_engineer-0.2.4/scripts/post_x/example_usage.py +0 -195
- reverse_api_engineer-0.2.4/scripts/web_scraping_task/README.md +0 -369
- reverse_api_engineer-0.2.4/scripts/web_scraping_task/api_client.py +0 -435
- reverse_api_engineer-0.2.4/scripts/web_scraping_task/example_usage.py +0 -192
- {reverse_api_engineer-0.2.4 → reverse_api_engineer-0.2.5}/.python-version +0 -0
- {reverse_api_engineer-0.2.4 → reverse_api_engineer-0.2.5}/CONTRIBUTING.md +0 -0
- {reverse_api_engineer-0.2.4 → reverse_api_engineer-0.2.5}/LICENSE +0 -0
- {reverse_api_engineer-0.2.4 → reverse_api_engineer-0.2.5}/README.md +0 -0
- {reverse_api_engineer-0.2.4 → reverse_api_engineer-0.2.5}/assets/reverse-api-banner.svg +0 -0
- {reverse_api_engineer-0.2.4 → reverse_api_engineer-0.2.5}/assets/reverse-api-engineer.gif +0 -0
- {reverse_api_engineer-0.2.4 → reverse_api_engineer-0.2.5}/assets/reverse-api-logo.svg +0 -0
- {reverse_api_engineer-0.2.4 → reverse_api_engineer-0.2.5}/src/reverse_api/__init__.py +0 -0
- {reverse_api_engineer-0.2.4 → reverse_api_engineer-0.2.5}/src/reverse_api/base_engineer.py +0 -0
- {reverse_api_engineer-0.2.4 → reverse_api_engineer-0.2.5}/src/reverse_api/browser.py +0 -0
- {reverse_api_engineer-0.2.4 → reverse_api_engineer-0.2.5}/src/reverse_api/cli.py +0 -0
- {reverse_api_engineer-0.2.4 → reverse_api_engineer-0.2.5}/src/reverse_api/config.py +0 -0
- {reverse_api_engineer-0.2.4 → reverse_api_engineer-0.2.5}/src/reverse_api/engineer.py +0 -0
- {reverse_api_engineer-0.2.4 → reverse_api_engineer-0.2.5}/src/reverse_api/messages.py +0 -0
- {reverse_api_engineer-0.2.4 → reverse_api_engineer-0.2.5}/src/reverse_api/opencode_ui.py +0 -0
- {reverse_api_engineer-0.2.4 → reverse_api_engineer-0.2.5}/src/reverse_api/session.py +0 -0
- {reverse_api_engineer-0.2.4 → reverse_api_engineer-0.2.5}/src/reverse_api/tui.py +0 -0
- {reverse_api_engineer-0.2.4 → reverse_api_engineer-0.2.5}/src/reverse_api/utils.py +0 -0
- {reverse_api_engineer-0.2.4 → reverse_api_engineer-0.2.5}/uv.lock +0 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"permissions": {
|
|
3
|
+
"allow": [
|
|
4
|
+
"WebFetch(domain:docs.browser-use.com)",
|
|
5
|
+
"Bash(git -C /Users/kalilbouzigues/Projects/browgents/reverse-api log --oneline)",
|
|
6
|
+
"Bash(python -c:*)",
|
|
7
|
+
"Bash(uv sync:*)",
|
|
8
|
+
"Bash(uv pip index versions:*)",
|
|
9
|
+
"Bash(pip index:*)",
|
|
10
|
+
"Bash(source:*)",
|
|
11
|
+
"WebSearch",
|
|
12
|
+
"WebFetch(domain:github.com)",
|
|
13
|
+
"WebFetch(domain:pypi.org)",
|
|
14
|
+
"WebFetch(domain:docs.stagehand.dev)",
|
|
15
|
+
"Bash(python -m py_compile:*)",
|
|
16
|
+
"Bash(find:*)",
|
|
17
|
+
"Bash(cat:*)",
|
|
18
|
+
"Bash(chmod:*)",
|
|
19
|
+
"Bash(python3:*)",
|
|
20
|
+
"Bash(grep:*)",
|
|
21
|
+
"Bash(./scripts/clean_build.sh:*)",
|
|
22
|
+
"Bash(git add:*)",
|
|
23
|
+
"Bash(uv publish)",
|
|
24
|
+
"Bash(export:*)",
|
|
25
|
+
"Bash(uv tool install:*)",
|
|
26
|
+
"Bash(uv cache clean:*)",
|
|
27
|
+
"Bash(reverse-api-engineer:*)",
|
|
28
|
+
"Bash(git tag:*)",
|
|
29
|
+
"Bash(git push:*)",
|
|
30
|
+
"Bash(git show:*)",
|
|
31
|
+
"Bash(~/.local/bin/reverse-api-engineer:*)",
|
|
32
|
+
"Bash(deactivate)",
|
|
33
|
+
"Bash(test_env/bin/pip install:*)",
|
|
34
|
+
"Bash(test_env/bin/reverse-api-engineer:*)",
|
|
35
|
+
"Bash(uv tool uninstall:*)",
|
|
36
|
+
"Bash(echo:*)",
|
|
37
|
+
"Bash(/Users/kalilbouzigues/.local/share/uv/tools/reverse-api-engineer/bin/reverse-api-engineer:*)",
|
|
38
|
+
"Bash(/Users/kalilbouzigues/.local/share/uv/tools/reverse-api-engineer/bin/python:*)",
|
|
39
|
+
"Bash(uv tool:*)",
|
|
40
|
+
"Bash(.venv/bin/python:*)",
|
|
41
|
+
"Bash(.venv/bin/reverse-api-engineer:*)",
|
|
42
|
+
"Bash(/Users/kalilbouzigues/.local/bin/reverse-api-engineer:*)",
|
|
43
|
+
"Bash(/opt/homebrew/bin/reverse-api-engineer:*)",
|
|
44
|
+
"Bash(/opt/homebrew/opt/python@3.14/bin/python3.14 -m pip:*)",
|
|
45
|
+
"Bash(pipx list:*)"
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -77,11 +77,10 @@ cython_debug/
|
|
|
77
77
|
|
|
78
78
|
# Project specific
|
|
79
79
|
har/
|
|
80
|
-
scripts
|
|
80
|
+
scripts/*
|
|
81
|
+
!scripts/clean_build.sh
|
|
81
82
|
scripts_built/
|
|
82
|
-
|
|
83
|
-
!scripts/*/example_usage.py
|
|
84
|
-
!scripts/*/README.md
|
|
83
|
+
src/reverse_api/scripts/
|
|
85
84
|
.reverse-api/
|
|
86
85
|
*.har
|
|
87
86
|
|
|
@@ -5,6 +5,20 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.2.5] - 2025-12-27
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- **OpenCodeEngineer initialization**: Refactored to properly pop specific kwargs (`opencode_provider` and `opencode_model`) before passing to parent class
|
|
12
|
+
- Ensures only relevant arguments are sent to BaseEngineer
|
|
13
|
+
- Improves initialization logic clarity and prevents unintended argument passing
|
|
14
|
+
|
|
15
|
+
## [0.2.4] - 2025-12-27
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
- **Version string**: Fixed `--version` flag to correctly display 0.2.4 instead of outdated 0.2.0
|
|
19
|
+
- Previous release (0.2.3) was built with stale bytecode cache
|
|
20
|
+
- Added clean build script (`scripts/clean_build.sh`) to prevent future stale builds
|
|
21
|
+
|
|
8
22
|
## [0.2.3] - 2025-12-27
|
|
9
23
|
|
|
10
24
|
### Changed
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: reverse-api-engineer
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.5
|
|
4
4
|
Summary: A tool to capture browser traffic for API reverse engineering
|
|
5
5
|
Project-URL: Homepage, https://github.com/kalil0321/reverse-api-engineer
|
|
6
6
|
Project-URL: Repository, https://github.com/kalil0321/reverse-api-engineer
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Clean build script - removes all build artifacts and caches before building
|
|
3
|
+
|
|
4
|
+
set -e # Exit on error
|
|
5
|
+
|
|
6
|
+
echo "🧹 Cleaning build artifacts..."
|
|
7
|
+
|
|
8
|
+
# Remove Python cache files
|
|
9
|
+
echo " → Removing __pycache__ directories..."
|
|
10
|
+
find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
|
|
11
|
+
find . -type f -name "*.pyc" -delete 2>/dev/null || true
|
|
12
|
+
find . -type f -name "*.pyo" -delete 2>/dev/null || true
|
|
13
|
+
|
|
14
|
+
# Remove build directories
|
|
15
|
+
echo " → Removing build directories..."
|
|
16
|
+
rm -rf dist/ build/ *.egg-info src/*.egg-info 2>/dev/null || true
|
|
17
|
+
|
|
18
|
+
# Remove any .pyc files in src
|
|
19
|
+
echo " → Removing compiled Python files in src/..."
|
|
20
|
+
find src -type f -name "*.pyc" -delete 2>/dev/null || true
|
|
21
|
+
|
|
22
|
+
echo "✅ Clean complete!"
|
|
23
|
+
echo ""
|
|
24
|
+
echo "🏗️ Building package..."
|
|
25
|
+
uv build
|
|
26
|
+
|
|
27
|
+
echo ""
|
|
28
|
+
echo "✅ Build complete!"
|
|
29
|
+
echo ""
|
|
30
|
+
echo "📦 Built files:"
|
|
31
|
+
ls -lh dist/
|
{reverse_api_engineer-0.2.4 → reverse_api_engineer-0.2.5}/src/reverse_api/opencode_engineer.py
RENAMED
|
@@ -40,12 +40,15 @@ class OpenCodeEngineer(BaseEngineer):
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
def __init__(self, *args, **kwargs):
|
|
43
|
+
# Pop OpenCode-specific kwargs before passing to parent class
|
|
44
|
+
self.opencode_provider = kwargs.pop("opencode_provider", "anthropic")
|
|
45
|
+
self.opencode_model = kwargs.pop("opencode_model", "claude-sonnet-4-5")
|
|
46
|
+
|
|
43
47
|
super().__init__(*args, **kwargs)
|
|
48
|
+
|
|
44
49
|
# Override UI with OpenCode-specific version
|
|
45
50
|
self.opencode_ui = OpenCodeUI(verbose=kwargs.get("verbose", True))
|
|
46
51
|
self.ui = self.opencode_ui # Ensure base class uses our specialized UI
|
|
47
|
-
self.opencode_provider = kwargs.get("opencode_provider", "anthropic")
|
|
48
|
-
self.opencode_model = kwargs.get("opencode_model", "claude-sonnet-4-5")
|
|
49
52
|
self._last_error: Optional[str] = None
|
|
50
53
|
self._session_id: Optional[str] = None
|
|
51
54
|
self._last_event_time = 0.0
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"permissions": {
|
|
3
|
-
"allow": [
|
|
4
|
-
"WebFetch(domain:docs.browser-use.com)",
|
|
5
|
-
"Bash(git -C /Users/kalilbouzigues/Projects/browgents/reverse-api log --oneline)",
|
|
6
|
-
"Bash(python -c:*)",
|
|
7
|
-
"Bash(uv sync:*)",
|
|
8
|
-
"Bash(uv pip index versions:*)",
|
|
9
|
-
"Bash(pip index:*)",
|
|
10
|
-
"Bash(source:*)",
|
|
11
|
-
"WebSearch",
|
|
12
|
-
"WebFetch(domain:github.com)",
|
|
13
|
-
"WebFetch(domain:pypi.org)",
|
|
14
|
-
"WebFetch(domain:docs.stagehand.dev)",
|
|
15
|
-
"Bash(python -m py_compile:*)",
|
|
16
|
-
"Bash(find:*)",
|
|
17
|
-
"Bash(cat:*)",
|
|
18
|
-
"Bash(chmod:*)",
|
|
19
|
-
"Bash(python3:*)",
|
|
20
|
-
"Bash(grep:*)",
|
|
21
|
-
"Bash(./scripts/clean_build.sh:*)"
|
|
22
|
-
]
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,463 +0,0 @@
|
|
|
1
|
-
# Tesla Careers API Client
|
|
2
|
-
|
|
3
|
-
This directory contains two versions of the Tesla Jobs API client:
|
|
4
|
-
|
|
5
|
-
1. **api_client_demo.py** - ✅ Demo client using cached data (RECOMMENDED)
|
|
6
|
-
2. **api_client.py** - ⚠️ Live API client with Playwright (challenging due to bot detection)
|
|
7
|
-
|
|
8
|
-
## 🚀 Quick Start - Demo Version (Recommended)
|
|
9
|
-
|
|
10
|
-
The demo version is ready to use immediately with no dependencies or bot detection issues.
|
|
11
|
-
|
|
12
|
-
```python
|
|
13
|
-
from api_client_demo import TeslaJobsAPIDemo
|
|
14
|
-
|
|
15
|
-
# Initialize the demo client
|
|
16
|
-
api = TeslaJobsAPIDemo()
|
|
17
|
-
|
|
18
|
-
# Search for AI jobs
|
|
19
|
-
ai_jobs = api.search_jobs(title="AI", limit=10)
|
|
20
|
-
|
|
21
|
-
# Get statistics
|
|
22
|
-
stats = api.get_statistics()
|
|
23
|
-
print(f"Total jobs: {stats['total_jobs']:,}")
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
Run the demo:
|
|
27
|
-
```bash
|
|
28
|
-
python3 api_client_demo.py
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
**Why use the demo version?**
|
|
32
|
-
- ✅ No bot detection challenges
|
|
33
|
-
- ✅ Instant responses
|
|
34
|
-
- ✅ Real Tesla job data (4,498+ jobs)
|
|
35
|
-
- ✅ All API methods work identically
|
|
36
|
-
- ✅ Perfect for development and testing
|
|
37
|
-
|
|
38
|
-
---
|
|
39
|
-
|
|
40
|
-
## 📂 File Overview
|
|
41
|
-
|
|
42
|
-
### 1. api_client_demo.py (Recommended)
|
|
43
|
-
**Status**: ✅ Ready to use
|
|
44
|
-
**Dependencies**: None (standard library only)
|
|
45
|
-
**Data**: Cached HAR file (tesla_jobs_cache.json)
|
|
46
|
-
**Jobs**: 4,498 real Tesla positions
|
|
47
|
-
**Locations**: 10,792 unique locations globally
|
|
48
|
-
|
|
49
|
-
**Use for:**
|
|
50
|
-
- Development and testing
|
|
51
|
-
- Demonstrations and prototypes
|
|
52
|
-
- Learning the API structure
|
|
53
|
-
- Avoiding bot detection headaches
|
|
54
|
-
|
|
55
|
-
### 2. api_client.py (Advanced)
|
|
56
|
-
**Status**: ⚠️ Challenging (Akamai bot detection)
|
|
57
|
-
**Dependencies**: Playwright, Chromium browser
|
|
58
|
-
**Data**: Live Tesla API
|
|
59
|
-
**Success Rate**: 10-30% without proxy services
|
|
60
|
-
|
|
61
|
-
**Use for:**
|
|
62
|
-
- Production with professional proxy services
|
|
63
|
-
- Real-time data requirements
|
|
64
|
-
- Custom cookie extraction solutions
|
|
65
|
-
|
|
66
|
-
See extensive troubleshooting documentation in the file header.
|
|
67
|
-
|
|
68
|
-
### 3. tesla_jobs_cache.json
|
|
69
|
-
**Size**: ~1.6 MB
|
|
70
|
-
**Source**: Extracted from HAR recording
|
|
71
|
-
**Contents**:
|
|
72
|
-
- 4,498 job listings
|
|
73
|
-
- 10,792 location mappings
|
|
74
|
-
- Department hierarchies
|
|
75
|
-
- Geographic data (58 countries, 5 regions)
|
|
76
|
-
|
|
77
|
-
Real Tesla job data in exact API format.
|
|
78
|
-
|
|
79
|
-
---
|
|
80
|
-
|
|
81
|
-
## 💡 Which Version Should I Use?
|
|
82
|
-
|
|
83
|
-
| Use Case | Recommended Version |
|
|
84
|
-
|----------|-------------------|
|
|
85
|
-
| Development & Testing | **api_client_demo.py** |
|
|
86
|
-
| Demonstrations | **api_client_demo.py** |
|
|
87
|
-
| Learning the API | **api_client_demo.py** |
|
|
88
|
-
| One-off data extraction | **api_client_demo.py** |
|
|
89
|
-
| Production (with proxy) | **api_client.py** + proxy service |
|
|
90
|
-
| Real-time monitoring | **api_client.py** + proxy service |
|
|
91
|
-
| Personal browsing | Tesla's official website |
|
|
92
|
-
|
|
93
|
-
---
|
|
94
|
-
|
|
95
|
-
## 🔍 APIs Discovered
|
|
96
|
-
|
|
97
|
-
### 1. **Get All Jobs** - `/cua-api/apps/careers/state`
|
|
98
|
-
- **Method:** GET
|
|
99
|
-
- **Returns:** All 4,498+ job listings globally
|
|
100
|
-
- **Cache:** 30 minutes
|
|
101
|
-
- **Response Size:** ~950KB uncompressed, ~205KB compressed
|
|
102
|
-
- **Data Included:**
|
|
103
|
-
- Complete job listings (abbreviated format)
|
|
104
|
-
- Location lookup tables (10,792 cities)
|
|
105
|
-
- Region mappings (5 regions)
|
|
106
|
-
- Country/site mappings (58 countries)
|
|
107
|
-
- Geographic hierarchy
|
|
108
|
-
|
|
109
|
-
### 2. **Get Job Details** - `/cua-api/careers/job/{job_id}`
|
|
110
|
-
- **Method:** GET
|
|
111
|
-
- **Returns:** Complete details for a specific job
|
|
112
|
-
- **Data Included:**
|
|
113
|
-
- Full job description (HTML)
|
|
114
|
-
- Responsibilities (HTML)
|
|
115
|
-
- Requirements (HTML)
|
|
116
|
-
- Compensation & benefits (HTML)
|
|
117
|
-
- Application URL
|
|
118
|
-
- Department and location information
|
|
119
|
-
|
|
120
|
-
## 🔐 Authentication
|
|
121
|
-
|
|
122
|
-
The API uses **cookie-based authentication** with Akamai Bot Manager protection:
|
|
123
|
-
|
|
124
|
-
### Required Cookies:
|
|
125
|
-
- `_abck` - Akamai Bot Manager cookie (critical, 1-year expiry)
|
|
126
|
-
- `bm_s` - Bot detection session data (31 days)
|
|
127
|
-
- `bm_sz` - Bot detection fingerprint (4 hours)
|
|
128
|
-
- `bm_ss`, `bm_so`, `bm_lso`, `bm_sc` - Additional bot detection cookies
|
|
129
|
-
- `cua_sess` - Tesla CUA session cookie (3 days)
|
|
130
|
-
|
|
131
|
-
### Bot Detection Handling:
|
|
132
|
-
This client uses **Playwright** with a real Chromium browser to:
|
|
133
|
-
1. Load the Tesla careers page
|
|
134
|
-
2. Wait for Akamai bot detection to complete
|
|
135
|
-
3. Extract valid cookies automatically
|
|
136
|
-
4. Make API requests with proper authentication
|
|
137
|
-
|
|
138
|
-
## 📦 Installation
|
|
139
|
-
|
|
140
|
-
### For Demo Version (Recommended):
|
|
141
|
-
```bash
|
|
142
|
-
# No installation required! Just Python 3.7+
|
|
143
|
-
python3 api_client_demo.py
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
### For Live Version (Advanced):
|
|
147
|
-
```bash
|
|
148
|
-
# Install Python dependencies
|
|
149
|
-
pip install playwright
|
|
150
|
-
|
|
151
|
-
# Install Playwright browsers
|
|
152
|
-
playwright install chromium
|
|
153
|
-
|
|
154
|
-
# Run (expect challenges with bot detection)
|
|
155
|
-
python3 api_client.py
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
## 🚀 Usage Examples
|
|
159
|
-
|
|
160
|
-
### Demo Version (Recommended):
|
|
161
|
-
|
|
162
|
-
#### Basic Example:
|
|
163
|
-
```python
|
|
164
|
-
from api_client_demo import TeslaJobsAPIDemo
|
|
165
|
-
|
|
166
|
-
# Initialize demo client
|
|
167
|
-
api = TeslaJobsAPIDemo()
|
|
168
|
-
|
|
169
|
-
# Get all jobs
|
|
170
|
-
data = api.get_all_jobs()
|
|
171
|
-
print(f"Total jobs: {len(data['listings']):,}")
|
|
172
|
-
|
|
173
|
-
# Search for AI jobs
|
|
174
|
-
ai_jobs = api.search_jobs(title="AI", limit=10)
|
|
175
|
-
for job in ai_jobs:
|
|
176
|
-
print(f"{job['t']} - {api.get_location_name(job['l'])}")
|
|
177
|
-
|
|
178
|
-
# Get job by ID
|
|
179
|
-
job = api.get_job_by_id("224501")
|
|
180
|
-
print(f"Job: {job['t']}")
|
|
181
|
-
print(f"Department: {api.get_department_name(str(job['dp']))}")
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
#### Advanced Filtering:
|
|
185
|
-
```python
|
|
186
|
-
from api_client_demo import TeslaJobsAPIDemo
|
|
187
|
-
|
|
188
|
-
api = TeslaJobsAPIDemo()
|
|
189
|
-
|
|
190
|
-
# Get all locations
|
|
191
|
-
locations = api.get_locations()
|
|
192
|
-
|
|
193
|
-
# Find Palo Alto location ID
|
|
194
|
-
palo_alto_id = [k for k, v in locations.items() if "Palo Alto" in v][0]
|
|
195
|
-
|
|
196
|
-
# Search for engineering jobs in Palo Alto
|
|
197
|
-
jobs = api.search_jobs(
|
|
198
|
-
title="Engineer",
|
|
199
|
-
location_id=palo_alto_id,
|
|
200
|
-
limit=20
|
|
201
|
-
)
|
|
202
|
-
|
|
203
|
-
# Get jobs by country
|
|
204
|
-
us_jobs = api.get_jobs_by_country("US", limit=100)
|
|
205
|
-
|
|
206
|
-
# Get jobs by department
|
|
207
|
-
ai_jobs = api.get_jobs_by_department("Tesla AI", limit=50)
|
|
208
|
-
|
|
209
|
-
# Get statistics
|
|
210
|
-
stats = api.get_statistics()
|
|
211
|
-
print(f"Top locations: {stats['top_locations'][:5]}")
|
|
212
|
-
print(f"Top departments: {stats['top_departments'][:5]}")
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
#### Save Data to Files:
|
|
216
|
-
```python
|
|
217
|
-
from api_client_demo import TeslaJobsAPIDemo
|
|
218
|
-
|
|
219
|
-
api = TeslaJobsAPIDemo()
|
|
220
|
-
all_data = api.get_all_jobs()
|
|
221
|
-
stats = api.get_statistics()
|
|
222
|
-
|
|
223
|
-
api.save_to_file(all_data, "tesla_jobs.json")
|
|
224
|
-
api.save_to_file(stats, "job_statistics.json")
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
### Live Version (Advanced - see api_client.py header for troubleshooting):
|
|
228
|
-
|
|
229
|
-
```python
|
|
230
|
-
from api_client import TeslaJobsAPI
|
|
231
|
-
|
|
232
|
-
# Initialize API client (headless mode)
|
|
233
|
-
# WARNING: High failure rate due to Akamai bot detection
|
|
234
|
-
with TeslaJobsAPI(headless=True) as api:
|
|
235
|
-
# Get all jobs (if bot detection allows)
|
|
236
|
-
data = api.get_all_jobs()
|
|
237
|
-
|
|
238
|
-
# Search for AI jobs
|
|
239
|
-
ai_jobs = api.search_jobs(title="AI", limit=10)
|
|
240
|
-
|
|
241
|
-
# Get job details (live API call)
|
|
242
|
-
job_details = api.get_job_details("224501")
|
|
243
|
-
print(f"Title: {job_details['title']}")
|
|
244
|
-
print(f"Apply: {job_details['applyUrl']}")
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
**Note:** For reliable production use with live data, see the extensive documentation in `api_client.py` about using professional proxy services.
|
|
248
|
-
|
|
249
|
-
## 📊 Data Structure
|
|
250
|
-
|
|
251
|
-
### Job Listing (Abbreviated):
|
|
252
|
-
```json
|
|
253
|
-
{
|
|
254
|
-
"id": "224501",
|
|
255
|
-
"t": "AI Engineer, Manipulation, Optimus",
|
|
256
|
-
"dp": "5", // Department ID
|
|
257
|
-
"f": "72", // Job family ID
|
|
258
|
-
"l": "401022", // Location ID (Palo Alto)
|
|
259
|
-
"y": 1,
|
|
260
|
-
"sp": 1, // Sort priority
|
|
261
|
-
"pu": null // Post until date
|
|
262
|
-
}
|
|
263
|
-
```
|
|
264
|
-
|
|
265
|
-
### Job Details (Complete):
|
|
266
|
-
```json
|
|
267
|
-
{
|
|
268
|
-
"id": "224501",
|
|
269
|
-
"title": "AI Engineer, Manipulation, Optimus",
|
|
270
|
-
"department": "Tesla AI",
|
|
271
|
-
"jobFamily": "AI",
|
|
272
|
-
"location": "Palo Alto, California",
|
|
273
|
-
"jobDescription": "<p>HTML content...</p>",
|
|
274
|
-
"jobResponsibilities": "<ul>...</ul>",
|
|
275
|
-
"jobRequirements": "<ul>...</ul>",
|
|
276
|
-
"jobCompensationAndBenefits": "<div>$140,000 - $420,000/annual...</div>",
|
|
277
|
-
"applicationType": "002",
|
|
278
|
-
"timeType": "Full-time",
|
|
279
|
-
"url": "/careers/search/job/...",
|
|
280
|
-
"applyUrl": "https://tesla.avature.net/Careers/ApplicationMethods?jobId=224501"
|
|
281
|
-
}
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
### Lookup Tables:
|
|
285
|
-
```json
|
|
286
|
-
{
|
|
287
|
-
"lookup": {
|
|
288
|
-
"regions": {
|
|
289
|
-
"1": "Africa",
|
|
290
|
-
"2": "Asia Pacific",
|
|
291
|
-
"3": "Europe",
|
|
292
|
-
"4": "Middle East",
|
|
293
|
-
"5": "North America"
|
|
294
|
-
},
|
|
295
|
-
"sites": {
|
|
296
|
-
"US": "United States of America",
|
|
297
|
-
"FR": "France",
|
|
298
|
-
"DE": "Germany",
|
|
299
|
-
...
|
|
300
|
-
},
|
|
301
|
-
"locations": {
|
|
302
|
-
"401022": "Palo Alto, California",
|
|
303
|
-
"402001": "Austin, Texas",
|
|
304
|
-
...
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
```
|
|
309
|
-
|
|
310
|
-
## ⚙️ API Methods
|
|
311
|
-
|
|
312
|
-
Both clients implement the same core interface:
|
|
313
|
-
|
|
314
|
-
### Core Methods:
|
|
315
|
-
|
|
316
|
-
| Method | Demo | Live | Description | Returns |
|
|
317
|
-
|--------|------|------|-------------|---------|
|
|
318
|
-
| `get_all_jobs()` | ✅ | ✅ | Fetch all job listings | Dict with listings and lookup tables |
|
|
319
|
-
| `get_job_by_id(job_id)` | ✅ | - | Get job from cache by ID | Dict (abbreviated format) |
|
|
320
|
-
| `get_job_details(job_id)` | - | ✅ | Get detailed job info (live API call) | Dict with complete job details |
|
|
321
|
-
| `search_jobs(...)` | ✅ | ✅ | Filter jobs client-side | List of matching jobs |
|
|
322
|
-
|
|
323
|
-
### Search & Filter Methods:
|
|
324
|
-
|
|
325
|
-
| Method | Description | Parameters | Returns |
|
|
326
|
-
|--------|-------------|------------|---------|
|
|
327
|
-
| `search_jobs()` | Multi-criteria search | title, location_id, department_id, job_family_id, limit | List of jobs |
|
|
328
|
-
| `get_jobs_by_country()` | Filter by country code | country_code, limit | List of jobs |
|
|
329
|
-
| `get_jobs_by_department()` | Filter by department name | department_name, limit | List of jobs |
|
|
330
|
-
|
|
331
|
-
### Lookup Methods:
|
|
332
|
-
|
|
333
|
-
| Method | Description | Returns |
|
|
334
|
-
|--------|-------------|---------|
|
|
335
|
-
| `get_locations()` | Get location ID → name mapping | Dict[str, str] |
|
|
336
|
-
| `get_location_name(id)` | Get single location name | str |
|
|
337
|
-
| `get_regions()` | Get region ID → name mapping | Dict[str, str] |
|
|
338
|
-
| `get_sites()` | Get country code → name mapping | Dict[str, str] |
|
|
339
|
-
| `get_departments()` | Get department ID → name mapping | Dict[str, str] |
|
|
340
|
-
| `get_department_name(id)` | Get single department name | str |
|
|
341
|
-
|
|
342
|
-
### Statistics & Utility (Demo only):
|
|
343
|
-
|
|
344
|
-
| Method | Description | Returns |
|
|
345
|
-
|--------|-------------|---------|
|
|
346
|
-
| `get_statistics()` | Get job statistics and rankings | Dict with top locations/departments |
|
|
347
|
-
| `get_cache_info()` | Get cache metadata | Dict with cache details |
|
|
348
|
-
| `save_to_file(data, filename)` | Save data to JSON file | None |
|
|
349
|
-
|
|
350
|
-
## ⚠️ Important Notes
|
|
351
|
-
|
|
352
|
-
### Filtering & Pagination:
|
|
353
|
-
- ✅ The API returns **ALL jobs** in a single request (no server-side filtering)
|
|
354
|
-
- ✅ All filtering must be done **client-side**
|
|
355
|
-
- ✅ Use the built-in `search_jobs()` method for filtering
|
|
356
|
-
- ✅ Cache is valid for 30 minutes (matches API cache-control)
|
|
357
|
-
|
|
358
|
-
### Rate Limiting:
|
|
359
|
-
- ⏱️ Don't fetch more often than every 30 minutes
|
|
360
|
-
- ⏱️ The API response is cached server-side
|
|
361
|
-
- ⏱️ Excessive requests will trigger bot detection
|
|
362
|
-
|
|
363
|
-
### Bot Detection:
|
|
364
|
-
- 🤖 Heavy Akamai protection on all endpoints
|
|
365
|
-
- 🤖 Cookies must be generated by a real browser
|
|
366
|
-
- 🤖 Playwright handles this automatically
|
|
367
|
-
- 🤖 Session cookies expire after 3-31 days
|
|
368
|
-
|
|
369
|
-
### Performance:
|
|
370
|
-
- 📦 Initial request: ~950KB uncompressed data
|
|
371
|
-
- 📦 Compressed transfer: ~205KB
|
|
372
|
-
- 📦 Contains 4,498+ job listings
|
|
373
|
-
- 📦 10,792 location mappings included
|
|
374
|
-
|
|
375
|
-
## 🧪 Testing
|
|
376
|
-
|
|
377
|
-
Run the included demo:
|
|
378
|
-
```bash
|
|
379
|
-
python api_client.py
|
|
380
|
-
```
|
|
381
|
-
|
|
382
|
-
Expected output:
|
|
383
|
-
```
|
|
384
|
-
======================================================================
|
|
385
|
-
Tesla Careers API Client - Demo
|
|
386
|
-
======================================================================
|
|
387
|
-
|
|
388
|
-
📊 Fetching all jobs...
|
|
389
|
-
✓ Total jobs available: 4498
|
|
390
|
-
|
|
391
|
-
🌍 Available locations:
|
|
392
|
-
✓ Total locations: 10792
|
|
393
|
-
✓ Regions: Africa, Asia Pacific, Europe, Middle East, North America
|
|
394
|
-
✓ Countries: 58
|
|
395
|
-
|
|
396
|
-
🔍 Searching for AI jobs...
|
|
397
|
-
✓ Found 5 AI jobs (showing top 5):
|
|
398
|
-
- AI Engineer, Manipulation, Optimus | Palo Alto, California
|
|
399
|
-
...
|
|
400
|
-
|
|
401
|
-
✓ Demo completed successfully!
|
|
402
|
-
```
|
|
403
|
-
|
|
404
|
-
## 🛠️ Troubleshooting
|
|
405
|
-
|
|
406
|
-
### Demo Version:
|
|
407
|
-
|
|
408
|
-
**Issue: "Cache file not found"**
|
|
409
|
-
- **Solution:** Ensure `tesla_jobs_cache.json` is in the same directory as `api_client_demo.py`
|
|
410
|
-
|
|
411
|
-
**Issue: "No results from search"**
|
|
412
|
-
- **Solution:** The search is case-insensitive partial match. Try broader terms or check location/department IDs.
|
|
413
|
-
|
|
414
|
-
### Live Version (api_client.py):
|
|
415
|
-
|
|
416
|
-
**Issue: "Request failed with 403 Forbidden"**
|
|
417
|
-
- **Cause:** Akamai detected the bot
|
|
418
|
-
- **Solutions:**
|
|
419
|
-
1. Use the demo version instead (recommended)
|
|
420
|
-
2. Extract cookies from real browser (see api_client.py header)
|
|
421
|
-
3. Use professional proxy service (ScraperAPI, Bright Data)
|
|
422
|
-
4. Run in non-headless mode (`headless=False`)
|
|
423
|
-
5. Increase wait time to 20+ seconds
|
|
424
|
-
|
|
425
|
-
**Issue: "Missing critical cookies (_abck, bm_sz)"**
|
|
426
|
-
- **Cause:** Akamai scripts didn't execute properly
|
|
427
|
-
- **Solutions:**
|
|
428
|
-
1. Disable headless mode
|
|
429
|
-
2. Check for JavaScript errors in browser console
|
|
430
|
-
3. Increase wait time after page load
|
|
431
|
-
4. Use demo version to avoid this issue
|
|
432
|
-
|
|
433
|
-
**Issue: "No jobs returned"**
|
|
434
|
-
- **Cause:** API structure may have changed, or request was blocked
|
|
435
|
-
- **Solutions:**
|
|
436
|
-
1. Check if `/cua-api/apps/careers/state` endpoint still exists
|
|
437
|
-
2. Verify response format in HAR file
|
|
438
|
-
3. Use demo version with cached data
|
|
439
|
-
|
|
440
|
-
**For all live API issues:** See the comprehensive troubleshooting guide in the `api_client.py` file header, which includes:
|
|
441
|
-
- Browser cookie extraction methods
|
|
442
|
-
- Proxy service recommendations
|
|
443
|
-
- Manual developer tools approach
|
|
444
|
-
- Alternative solutions
|
|
445
|
-
|
|
446
|
-
## 📝 License
|
|
447
|
-
|
|
448
|
-
This is a reverse-engineered API client for educational purposes.
|
|
449
|
-
Respect Tesla's terms of service and rate limits when using this tool.
|
|
450
|
-
|
|
451
|
-
## 🤝 Contributing
|
|
452
|
-
|
|
453
|
-
This client was automatically generated by the Reverse API Tool.
|
|
454
|
-
To improve or update:
|
|
455
|
-
1. Capture a new HAR file from tesla.com/careers
|
|
456
|
-
2. Re-run the reverse engineering process
|
|
457
|
-
3. Update API endpoints and authentication as needed
|
|
458
|
-
|
|
459
|
-
## 📚 Additional Resources
|
|
460
|
-
|
|
461
|
-
- Tesla Careers: https://www.tesla.com/careers
|
|
462
|
-
- HAR File Location: `/Users/kalilbouzigues/.reverse-api/runs/har/78c4747db520/recording.har`
|
|
463
|
-
- Generated: 2025-12-23
|