peakfo 1.0.0
Peak.fo API Client - Solve Turnstile, CloudFlare WAF, and AWS WAF challenges
License: MIT
Requires Python: >=3.7
Keywords: captcha, turnstile, cloudflare, aws, waf, solver

# Peak.fo Python SDK

Official Python client library for [Peak.fo](https://peak.fo) - the fastest captcha solving API for Turnstile, CloudFlare WAF, and AWS WAF challenges.

## 🚀 Features

- **Turnstile Solver** - Solve CloudFlare Turnstile challenges
- **CloudFlare WAF Solver** - Bypass CloudFlare 5-second challenges
- **AWS WAF Solver** - Solve AWS WAF challenges for iOS/Android mobile apps

## 📦 Installation

```bash
pip install peakfo
```

## 🎁 Free Trial

New users receive **$0.50 free trial credits** when signing up at [peak.fo](https://peak.fo)!

## 🔧 Quick Start

```python
from peakfo import PeakClient

# Initialize client with your API key
client = PeakClient("pk_your_api_key_here")

# Check your balance
balance = client.get_balance()
print(f"Balance: ${balance['balance']}")
```

## 📖 Usage Examples

### Solve Turnstile

```python
from peakfo import PeakClient

client = PeakClient("pk_your_api_key")

result = client.solve_turnstile(
    sitekey="0x4AAAAAAXXXXXXXXXXXXXXX",
    url="https://example.com/login",
    proxy="http://user:pass@ip:port"
)

print(f"Token: {result['token']}")
```

### Solve CloudFlare WAF (5-second challenge)

```python
from peakfo import PeakClient

client = PeakClient("pk_your_api_key")

result = client.solve_cloudflare_waf(
    url="https://example.com/",  # Must end with /
    proxy="http://user:pass@ip:port"
)

print(f"Cookies: {result['cookies']}")
print(f"User-Agent: {result['user_agent']}")
```

> ⚠️ **Note:** URL must end with trailing slash. Only Windows Chrome user agents are supported.

### Solve AWS WAF (Mobile SDK)

```python
from peakfo import PeakClient

client = PeakClient("pk_your_api_key")

result = client.solve_aws_waf(
    url="https://app.example.com/",
    sdk_url="https://xxx.edge.sdk.awswaf.com/xxx/xxx",
    proxy="http://user:pass@ip:port",
    user_agent="ExampleApp/1.0 (iOS 17.0)",
    os="ios"  # or "android"
)

print(f"Token: {result['token']}")
```

> ⚠️ **Note:** AWS WAF solver is for mobile apps only (iOS/Android SDK), not web browsers.

## 🔑 Finding AWS WAF SDK URL

The SDK URL can be found by:
1. Intercepting your app's network traffic (using Charles, mitmproxy, etc.)
2. Looking for requests to `*.edge.sdk.awswaf.com`
3. The URL format is: `https://{id}.edge.sdk.awswaf.com/{id}/{token}`

## ⚠️ Error Handling

```python
from peakfo import PeakClient, AuthenticationError, InsufficientBalanceError, SolveError

client = PeakClient("pk_your_api_key")

try:
    result = client.solve_turnstile(
        sitekey="0x4AAAAAAXXXXXXX",
        url="https://example.com/",
        proxy="http://user:pass@ip:port"
    )
except AuthenticationError:
    print("Invalid API key")
except InsufficientBalanceError:
    print("Please top up your balance")
except SolveError as e:
    print(f"Solve failed: {e}")
```

## 💰 Pricing

| Task Type | Price per 1K |
|-----------|-------------|
| Turnstile | $1.00 |
| CloudFlare WAF | $1.20 |
| AWS WAF | $1.00 |

## 📞 Support

- **Website:** [peak.fo](https://peak.fo)
- **Live Chat:** Available on website
- **Telegram:** [@jujucodings](https://t.me/jujucodings)

## 📄 License

MIT License - see [LICENSE](LICENSE) for details.