# Cloudflare URL Scanner PY-SDK
Python SDK for the Cloudflare URL Scanner API. It provides a simple way to interact with the API and scan URLs for malware, phishing, and more. To better understand Internet usage around the world, use Cloudflare’s URL Scanner. With Cloudflare’s URL Scanner, you have the ability to investigate the details of a domain, IP, URL, or ASN. Cloudflare’s URL Scanner is available in the Security Center of the Cloudflare dashboard, [Cloudflare Radar](https://radar.cloudflare.com/scan) and the [Cloudflare API](https://developers.cloudflare.com/api/operations/urlscanner-search-scans).
Read more about the Cloudflare URL Scanner API [here](https://developers.cloudflare.com/radar/investigate/url-scanner/).
> [!NOTE]
> This SDK is **not** an official Cloudflare product.
> [!NOTE]
> By default, the report will have a Public visibility level, which means it will appear in the recent scans list and in search results. It will also include a single screenshot with desktop resolution.
## Features
- Scan a URL
- Get the scan result
- Search for a scan by hostname
- Search for a scan by UUID
- Many more
- Async support
## Installation
From pip:
```bash
pip install cloudflarescan
```
From github:
```bash
python -m pip install -U git+https://github.com/alexraskin/cloudflare-url-scan
```
From source:
```bash
git clone
cd cloudflare-url-scan
python -m pip install .
```
## Usage
To make your first URL scan using the API, you must obtain a URL Scanner specific [API token](https://developers.cloudflare.com/fundamentals/api/get-started/create-token/). Create a Custom Token with Account > URL Scanner in the Permissions group, and select Edit as the access level.
```python
from cloudflare_scan import UrlScannerClient
cf_client = Client(
cloudflare_api_key="", #or set the environment variable CLOUDFLARE_API_KEY
cloudflare_account_id="", #or set the environment variable CLOUDFLARE_ACCOUNT_ID
)
# Scan a URL
scan = cf_client.scan("example.com")
# Get the scan result
result = scan.result
# Get the UUID of the scan
uuid = scan.uuid
# Get the screenshot of the scan
screenshot = cf_client.get_screen_shots(uuid, resolution="desktop")
# Get the HAR file of the scan
har = cf_client.get_har(uuid)
# Get the scan by UUID
scan = cf_client.get_scan(uuid)
```
## Async Usage
```python
from cloudflare_scan import AsyncClient
import asyncio
cf_client = AsyncClient(
cloudflare_api_key="",
cloudflare_account_id=""
)
async def main():
scan = await cf_client.scan("https://www.google.com")
print(scan.result)
print(scan.json)
asyncio.run(main())
```
## License
MIT License [LICENSE]
Raw data
{
"_id": null,
"home_page": "https://github.com/alexraskin/cloudflare-url-scan",
"name": "cloudflarescan",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "module,Cloudflare,library,package,python,Cloudflare URL Scanner SDK",
"author": "alexraskin",
"author_email": "<root@alexraskin.com>",
"download_url": "https://files.pythonhosted.org/packages/91/c5/fa38ab31f893c1b766a428d372937141eee78d5e514d2854b34c407937be/cloudflarescan-0.5.0.tar.gz",
"platform": null,
"description": "# Cloudflare URL Scanner PY-SDK\n\nPython SDK for the Cloudflare URL Scanner API. It provides a simple way to interact with the API and scan URLs for malware, phishing, and more. To better understand Internet usage around the world, use Cloudflare\u2019s URL Scanner. With Cloudflare\u2019s URL Scanner, you have the ability to investigate the details of a domain, IP, URL, or ASN. Cloudflare\u2019s URL Scanner is available in the Security Center of the Cloudflare dashboard, [Cloudflare Radar](https://radar.cloudflare.com/scan) and the [Cloudflare API](https://developers.cloudflare.com/api/operations/urlscanner-search-scans).\n\nRead more about the Cloudflare URL Scanner API [here](https://developers.cloudflare.com/radar/investigate/url-scanner/).\n\n> [!NOTE]\n> This SDK is **not** an official Cloudflare product.\n\n> [!NOTE]\n> By default, the report will have a Public visibility level, which means it will appear in the recent scans list and in search results. It will also include a single screenshot with desktop resolution.\n\n## Features\n\n- Scan a URL\n- Get the scan result\n- Search for a scan by hostname\n- Search for a scan by UUID\n- Many more\n- Async support\n\n## Installation\n\nFrom pip:\n\n```bash\npip install cloudflarescan\n```\n\nFrom github:\n\n```bash\npython -m pip install -U git+https://github.com/alexraskin/cloudflare-url-scan\n```\n\nFrom source:\n\n```bash\ngit clone\ncd cloudflare-url-scan\npython -m pip install .\n```\n\n## Usage\n\nTo make your first URL scan using the API, you must obtain a URL Scanner specific [API token](https://developers.cloudflare.com/fundamentals/api/get-started/create-token/). Create a Custom Token with Account > URL Scanner in the Permissions group, and select Edit as the access level.\n\n```python\nfrom cloudflare_scan import UrlScannerClient\n\n\ncf_client = Client(\n cloudflare_api_key=\"\", #or set the environment variable CLOUDFLARE_API_KEY\n cloudflare_account_id=\"\", #or set the environment variable CLOUDFLARE_ACCOUNT_ID\n)\n\n# Scan a URL\nscan = cf_client.scan(\"example.com\")\n\n# Get the scan result\nresult = scan.result\n\n# Get the UUID of the scan\nuuid = scan.uuid\n\n# Get the screenshot of the scan\nscreenshot = cf_client.get_screen_shots(uuid, resolution=\"desktop\")\n\n# Get the HAR file of the scan\nhar = cf_client.get_har(uuid)\n\n# Get the scan by UUID\nscan = cf_client.get_scan(uuid)\n```\n\n## Async Usage\n\n```python\nfrom cloudflare_scan import AsyncClient\nimport asyncio\n\ncf_client = AsyncClient(\n cloudflare_api_key=\"\",\n cloudflare_account_id=\"\"\n )\n\nasync def main():\n scan = await cf_client.scan(\"https://www.google.com\")\n print(scan.result)\n print(scan.json)\n\nasyncio.run(main())\n```\n\n## License\n\nMIT License [LICENSE]\n",
"bugtrack_url": null,
"license": "Mozilla Public License 2.0",
"summary": "Cloudflare URL Scanner SDK",
"version": "0.5.0",
"project_urls": {
"Homepage": "https://github.com/alexraskin/cloudflare-url-scan"
},
"split_keywords": [
"module",
"cloudflare",
"library",
"package",
"python",
"cloudflare url scanner sdk"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3a394b546571e3722186320c7d219e7bdba6c68d9042ca2c758a3a2964b5d2c5",
"md5": "397b489f062df977afbd7b80aea4f979",
"sha256": "634c6750501d757e02a867ee1fbdcf226788c41f4fb70d9bda0f61f0a0ac35ba"
},
"downloads": -1,
"filename": "cloudflarescan-0.5.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "397b489f062df977afbd7b80aea4f979",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 8603,
"upload_time": "2024-03-14T02:53:47",
"upload_time_iso_8601": "2024-03-14T02:53:47.679929Z",
"url": "https://files.pythonhosted.org/packages/3a/39/4b546571e3722186320c7d219e7bdba6c68d9042ca2c758a3a2964b5d2c5/cloudflarescan-0.5.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "91c5fa38ab31f893c1b766a428d372937141eee78d5e514d2854b34c407937be",
"md5": "527058b575b29cc32464082d80540b85",
"sha256": "ff535b445421424cbf30e2eea123bc82ce9ac0602006da89e2b7c213ed7e9d59"
},
"downloads": -1,
"filename": "cloudflarescan-0.5.0.tar.gz",
"has_sig": false,
"md5_digest": "527058b575b29cc32464082d80540b85",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 8118,
"upload_time": "2024-03-14T02:53:49",
"upload_time_iso_8601": "2024-03-14T02:53:49.611910Z",
"url": "https://files.pythonhosted.org/packages/91/c5/fa38ab31f893c1b766a428d372937141eee78d5e514d2854b34c407937be/cloudflarescan-0.5.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-14 02:53:49",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "alexraskin",
"github_project": "cloudflare-url-scan",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "cloudflarescan"
}