The official Python API client for urlscan.io
Project description
urlscan-python
The official Python API client for urlscan.io.
Requirements
- Python 3.10+
Installation
pip install urlscan-python
Quickstart
Start by importing urlscan module:
import urlscan
Create a client with your API key:
with urlscan.Client("<your_api_key>") as client:
...
[!NOTE] The recommended way to use
Clientis as a context manager like the above. This will ensure closing a connection when leaving the with block.Alternatively, you can explicitly close the connection pool without block-usage using
._close():client = urlscan.Client("<your_api_key>") try: ... finally: client._close()
Scan a URL:
res = client.scan("<url>", visibility="public")
uuid: str = res["uuid"]
Wait for a scan result:
client.wait_for_result(uuid)
Get a scan result:
result = client.get_result(uuid)
Bulk scan:
client.bulk_scan(["<url>", "<url>"], visibility="public")
Alternatively, you can use _and_get_result(s) suffixed methods to do scan, wait and get at once.
client.scan_and_get_result("<url>", visibility="public")
client.bulk_scan_and_get_results(["<url>", "<url>"], visibility="public")
urlscan.Client.search() returns an iterator to iterate search results:
for result in client.search("page.domain:example.com"):
print(result["_id"])
Pro
Use Pro class to interact with the pro API endpoints:
from urlscan import Pro
with Pro("<your_api_key>") as client:
res = client.livescan.scan("<url>", scanner_id="us01")
resource_id: str = res["uuid"]
result = client.livescan.get_resource(scanner_id="us01", resource_id=resource_id, resource_type="result")
Examples
See Examples.
References
Help Wanted?
Please feel free to to open an issue if you find a bug or some feature that you want to see implemented.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file urlscan_python-2026.3.26.tar.gz.
File metadata
- Download URL: urlscan_python-2026.3.26.tar.gz
- Upload date:
- Size: 107.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
81cc0d9544ea337ea86bedb0b61f6926006bd9d86fb1b5ce8cb585425f69e695
|
|
| MD5 |
7bf6cb6ccfc8341699f49fe0117bad5f
|
|
| BLAKE2b-256 |
8876a7461d1d754fdf595baea8deaec658f696e8710eab16fe3b748a7223189b
|
Provenance
The following attestation bundles were made for urlscan_python-2026.3.26.tar.gz:
Publisher:
publish.yml on urlscan/urlscan-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
urlscan_python-2026.3.26.tar.gz -
Subject digest:
81cc0d9544ea337ea86bedb0b61f6926006bd9d86fb1b5ce8cb585425f69e695 - Sigstore transparency entry: 1185123933
- Sigstore integration time:
-
Permalink:
urlscan/urlscan-python@ab8ee4de40bb93b2b0cedce86bff0c136e23c4d3 -
Branch / Tag:
refs/tags/v2026.03.26 - Owner: https://github.com/urlscan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ab8ee4de40bb93b2b0cedce86bff0c136e23c4d3 -
Trigger Event:
release
-
Statement type:
File details
Details for the file urlscan_python-2026.3.26-py3-none-any.whl.
File metadata
- Download URL: urlscan_python-2026.3.26-py3-none-any.whl
- Upload date:
- Size: 26.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1b9a4d190d873844f1bd54e16a4b494f8be1d6d5cd3eeb831a6baf03a2e91567
|
|
| MD5 |
0e0d12fe69d77267271bcbf70e8a14bb
|
|
| BLAKE2b-256 |
48102be33deb71eb3012a98d81e6bc9c6b4695ce324a230f67b38d60b8ca7671
|
Provenance
The following attestation bundles were made for urlscan_python-2026.3.26-py3-none-any.whl:
Publisher:
publish.yml on urlscan/urlscan-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
urlscan_python-2026.3.26-py3-none-any.whl -
Subject digest:
1b9a4d190d873844f1bd54e16a4b494f8be1d6d5cd3eeb831a6baf03a2e91567 - Sigstore transparency entry: 1185123947
- Sigstore integration time:
-
Permalink:
urlscan/urlscan-python@ab8ee4de40bb93b2b0cedce86bff0c136e23c4d3 -
Branch / Tag:
refs/tags/v2026.03.26 - Owner: https://github.com/urlscan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ab8ee4de40bb93b2b0cedce86bff0c136e23c4d3 -
Trigger Event:
release
-
Statement type: