| Name | deflect JSON |
| Version |
0.1.1
JSON |
| download |
| home_page | None |
| Summary | Official Deflect Protection SDK for Python |
| upload_time | 2025-10-28 10:18:32 |
| maintainer | None |
| docs_url | None |
| author | Deflect |
| requires_python | >=3.8 |
| license | MIT |
| keywords |
deflect
bot
security
antibot
|
| VCS |
 |
| bugtrack_url |
|
| requirements |
No requirements were recorded.
|
| Travis-CI |
No Travis.
|
| coveralls test coverage |
No coveralls.
|
# Deflect Python SDK
Early Python SDK for the Deflect Bot Protection API (experimental).
## Installation
Install PyPi package:
```bash
pip install deflect
```
## Quick Start (Sync)
```python
from deflect import Deflect, DeflectOptions, VerdictRequest
client = Deflect(DeflectOptions(api_key="YOUR_KEY", action_id="YOUR_ACTION"))
verdict = client.get_verdict(VerdictRequest(
token=user_session_token,
# Optional Identity Enrichment
id="user_123", # Required for access control
email="user@example.com", # Optional email
phone_number="+14155552671" # Optional phone number
))
if verdict.get("verdict", {}).get("can_pass"):
# allow
...
else:
# block
...
```
## Quick Start (Async)
```python
import asyncio
from deflect import AsyncDeflect, DeflectOptions, VerdictRequest
async def main():
client = AsyncDeflect(DeflectOptions(api_key="YOUR_KEY", action_id="YOUR_ACTION"))
verdict = await client.get_verdict(VerdictRequest(token=user_session_token))
print(verdict)
asyncio.run(main())
```
## Intelligence APIs
### Email Intelligence
```python
from deflect import Deflect, DeflectOptions
client = Deflect(DeflectOptions(api_key="YOUR_KEY", action_id="YOUR_ACTION"))
result = client.email_intelligence("user@example.com")
if result.get("success"):
data = result.get("data", {})
print(f"Valid: {data.get('is_valid')}")
print(f"Trusted: {data.get('is_trusted')}")
print(f"Trust Score: {data.get('trust_score')}")
print(f"Has Aliasing: {data.get('has_aliasing')}")
print(f"Normalized: {data.get('normalized_email')}")
```
### Phone Intelligence
```python
from deflect import Deflect, DeflectOptions
client = Deflect(DeflectOptions(api_key="YOUR_KEY", action_id="YOUR_ACTION"))
result = client.phone_intelligence("+14155552671")
if result.get("success"):
data = result.get("data", {})
print(f"Valid: {data.get('is_valid')}")
print(f"Country: {data.get('country_name')}")
print(f"Carrier: {data.get('carrier')}")
print(f"Line Type: {data.get('line_type')}")
print(f"Risk Score: {data.get('risk_score')}")
print(f"Is Spam: {data.get('is_spam')}")
```
### IP Intelligence
```python
from deflect import Deflect, DeflectOptions
client = Deflect(DeflectOptions(api_key="YOUR_KEY", action_id="YOUR_ACTION"))
result = client.ip_intelligence("8.8.8.8")
if result.get("success"):
data = result.get("data", {})
print(f"Is VPN: {data.get('is_vpn')}")
print(f"Is Proxy: {data.get('is_datacenter_proxy')}")
print(f"Is Threat: {data.get('is_threat')}")
print(f"Location: {data.get('city')}, {data.get('country')}")
print(f"ISP: {data.get('isp')}")
```
## Configuration
`DeflectOptions`:
- `api_key` (str, required)
- `action_id` (str, required)
- `base_url` (str, default `https://api.deflect.bot`)
- `timeout` (float seconds, default 4.0)
- `max_retries` (int, default 2)
- `client` / `async_client` (inject custom `httpx` client instances)
## Errors
Raises `DeflectError` with attributes:
- `status` (int | None)
- `body` (parsed JSON or None)
## Testing
```bash
pytest -q
```
## License
MIT
Raw data
{
"_id": null,
"home_page": null,
"name": "deflect",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "deflect, bot, security, antibot",
"author": "Deflect",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/b9/95/5089915334710c496fb01b3bd2bd9ca13d522a9fcc97c51f40324b46829a/deflect-0.1.1.tar.gz",
"platform": null,
"description": "# Deflect Python SDK\n\nEarly Python SDK for the Deflect Bot Protection API (experimental).\n\n## Installation\n\nInstall PyPi package:\n```bash\npip install deflect\n```\n\n## Quick Start (Sync)\n```python\nfrom deflect import Deflect, DeflectOptions, VerdictRequest\n\nclient = Deflect(DeflectOptions(api_key=\"YOUR_KEY\", action_id=\"YOUR_ACTION\"))\nverdict = client.get_verdict(VerdictRequest(\n token=user_session_token,\n # Optional Identity Enrichment\n id=\"user_123\", # Required for access control\n email=\"user@example.com\", # Optional email\n phone_number=\"+14155552671\" # Optional phone number\n))\nif verdict.get(\"verdict\", {}).get(\"can_pass\"):\n # allow\n ...\nelse:\n # block\n ...\n```\n\n## Quick Start (Async)\n```python\nimport asyncio\nfrom deflect import AsyncDeflect, DeflectOptions, VerdictRequest\n\nasync def main():\n client = AsyncDeflect(DeflectOptions(api_key=\"YOUR_KEY\", action_id=\"YOUR_ACTION\"))\n verdict = await client.get_verdict(VerdictRequest(token=user_session_token))\n print(verdict)\n\nasyncio.run(main())\n```\n\n## Intelligence APIs\n\n### Email Intelligence\n```python\nfrom deflect import Deflect, DeflectOptions\n\nclient = Deflect(DeflectOptions(api_key=\"YOUR_KEY\", action_id=\"YOUR_ACTION\"))\nresult = client.email_intelligence(\"user@example.com\")\n\nif result.get(\"success\"):\n data = result.get(\"data\", {})\n print(f\"Valid: {data.get('is_valid')}\")\n print(f\"Trusted: {data.get('is_trusted')}\")\n print(f\"Trust Score: {data.get('trust_score')}\")\n print(f\"Has Aliasing: {data.get('has_aliasing')}\")\n print(f\"Normalized: {data.get('normalized_email')}\")\n```\n\n### Phone Intelligence\n```python\nfrom deflect import Deflect, DeflectOptions\n\nclient = Deflect(DeflectOptions(api_key=\"YOUR_KEY\", action_id=\"YOUR_ACTION\"))\nresult = client.phone_intelligence(\"+14155552671\")\n\nif result.get(\"success\"):\n data = result.get(\"data\", {})\n print(f\"Valid: {data.get('is_valid')}\")\n print(f\"Country: {data.get('country_name')}\")\n print(f\"Carrier: {data.get('carrier')}\")\n print(f\"Line Type: {data.get('line_type')}\")\n print(f\"Risk Score: {data.get('risk_score')}\")\n print(f\"Is Spam: {data.get('is_spam')}\")\n```\n\n### IP Intelligence\n```python\nfrom deflect import Deflect, DeflectOptions\n\nclient = Deflect(DeflectOptions(api_key=\"YOUR_KEY\", action_id=\"YOUR_ACTION\"))\nresult = client.ip_intelligence(\"8.8.8.8\")\n\nif result.get(\"success\"):\n data = result.get(\"data\", {})\n print(f\"Is VPN: {data.get('is_vpn')}\")\n print(f\"Is Proxy: {data.get('is_datacenter_proxy')}\")\n print(f\"Is Threat: {data.get('is_threat')}\")\n print(f\"Location: {data.get('city')}, {data.get('country')}\")\n print(f\"ISP: {data.get('isp')}\")\n```\n\n## Configuration\n`DeflectOptions`:\n- `api_key` (str, required)\n- `action_id` (str, required)\n- `base_url` (str, default `https://api.deflect.bot`)\n- `timeout` (float seconds, default 4.0)\n- `max_retries` (int, default 2)\n- `client` / `async_client` (inject custom `httpx` client instances)\n\n## Errors\nRaises `DeflectError` with attributes:\n- `status` (int | None)\n- `body` (parsed JSON or None)\n\n## Testing\n```bash\npytest -q\n```\n\n## License\nMIT\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Official Deflect Protection SDK for Python",
"version": "0.1.1",
"project_urls": {
"Homepage": "https://docs.deflect.bot/",
"Issues": "https://github.com/deflectbot/deflect-python/issues",
"Source": "https://github.com/deflectbot/deflect-python"
},
"split_keywords": [
"deflect",
" bot",
" security",
" antibot"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "a282100b59522e55d166a730c803d74311346fce02e9b47764ece879e501834e",
"md5": "58d5b889d57c6c369dcc22a92eb1e74d",
"sha256": "60f81f0efe246df01f75026216e172a75c733da497450569c5dc28e48034245d"
},
"downloads": -1,
"filename": "deflect-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "58d5b889d57c6c369dcc22a92eb1e74d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 4793,
"upload_time": "2025-10-28T10:18:31",
"upload_time_iso_8601": "2025-10-28T10:18:31.146442Z",
"url": "https://files.pythonhosted.org/packages/a2/82/100b59522e55d166a730c803d74311346fce02e9b47764ece879e501834e/deflect-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "b9955089915334710c496fb01b3bd2bd9ca13d522a9fcc97c51f40324b46829a",
"md5": "f612fa131778ba6b21932bcbdee8d2f0",
"sha256": "96f13fea8a7da4b3183c71c220c02991191fe6b81bc215f52005afa398a2a754"
},
"downloads": -1,
"filename": "deflect-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "f612fa131778ba6b21932bcbdee8d2f0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 7074,
"upload_time": "2025-10-28T10:18:32",
"upload_time_iso_8601": "2025-10-28T10:18:32.253583Z",
"url": "https://files.pythonhosted.org/packages/b9/95/5089915334710c496fb01b3bd2bd9ca13d522a9fcc97c51f40324b46829a/deflect-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-10-28 10:18:32",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "deflectbot",
"github_project": "deflect-python",
"github_not_found": true,
"lcname": "deflect"
}