AWS Lambda (Python) to Query API Protected by Cloudflare Turnstile

Job ID: 40261966

Budget: $10 – $30 USD

## Project Overview

I need a developer to build an **AWS Lambda function (Python 3.14)** that programmatically retrieves vehicle inspection history (VTV) from the Buenos Aires Province system.

The public page is:

[https://vtv.gba.gob.ar/consultar-vtv](https://vtv.gba.gob.ar/consultar-vtv)

The actual API endpoint being called is:

[https://vtv-web-api.transporte.gba.gob.ar/api/historialvtvs/patente/Af839du](https://vtv-web-api.transporte.gba.gob.ar/api/historialvtvs/patente/Af839du)

The API request requires a valid **Cloudflare Turnstile token** to be sent in the header:

```
X-Turnstile-Token: <token>
```

## Objective

Create a production-ready Lambda function that:

* Accepts a vehicle plate as input (example: `Af839du`)
* Obtains and solves the Cloudflare Turnstile challenge (using Anti-Captcha or similar)
* Calls the protected API endpoint with the required headers
* Returns structured JSON output
* Is fully deployable on AWS Lambda (Linux x86_64 runtime)

---

## Required Headers (as observed)

The request must replicate browser behavior, including headers such as:

```
sec-ch-ua-platform: "macOS"
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36
sec-ch-ua: "Not:A-Brand";v="99", "Google Chrome";v="145", "Chromium";v="145"
DNT: 1
Content-Type: application/json
sec-ch-ua-mobile: ?0
Accept: */*
Sec-Fetch-Site: same-site
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
host: vtv-web-api.transporte.gba.gob.ar
X-Turnstile-Token: <generated_token>
```

The Lambda must properly handle:

* Session initialization
* Cookies
* Turnstile token generation
* Proper header injection

---

## Deliverables

1. `lambda_function.py` (production-ready)
2. `requirements.txt`
3. Deployment-ready ZIP including dependencies
4. `build.sh` (Docker-based build for Lambda compatibility)
5. README with:

* Environment variable setup
* Deployment steps
* Example test event
* Troubleshooting notes

---

## Environment Variables

The solution must use environment variables for:

* `ANTICAPTCHA_API_KEY`
* `TARGET_BASE_URL`
* Optional proxy configuration (if IP consistency is required)

---

## Lambda Input Example

```json
{
"plate": "Af839du"
}
```

---

## Expected Output

Structured JSON including:

* timestamp
* requestId
* payload
* metadata
* result (raw API response)


---

Budget: 25usd