Metadata-Version: 2.4
Name: peakfo
Version: 1.0.0
Summary: Peak.fo API Client - Solve Turnstile, CloudFlare WAF, and AWS WAF challenges
Home-page: https://github.com/peakfo/peakfo-python
Author: Peak.fo
Author-email: "Peak.fo" <support@peak.fo>
License: MIT
Project-URL: Homepage, https://peak.fo
Project-URL: Documentation, https://peak.fo/docs
Project-URL: Repository, https://github.com/peakfo/peakfo-python
Keywords: captcha,turnstile,cloudflare,aws,waf,solver
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.25.0
Dynamic: author
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-python

# 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.
