diff --git a/api.md b/api.md
index 8a4b3ca8632..8ebf78d8726 100644
--- a/api.md
+++ b/api.md
@@ -6522,7 +6522,7 @@ from cloudflare.types.url_scanner import (
Methods:
-- client.url_scanner.scans.create(account_id, \*\*params) -> ScanCreateResponse
+- client.url_scanner.scans.create(account_id, \*\*params) -> str
- client.url_scanner.scans.list(account_id, \*\*params) -> ScanListResponse
- client.url_scanner.scans.get(scan_id, \*, account_id, \*\*params) -> ScanGetResponse
- client.url_scanner.scans.har(scan_id, \*, account_id) -> ScanHARResponse
diff --git a/src/cloudflare/resources/url_scanner/scans.py b/src/cloudflare/resources/url_scanner/scans.py
index a036a227bb7..baf50f79952 100644
--- a/src/cloudflare/resources/url_scanner/scans.py
+++ b/src/cloudflare/resources/url_scanner/scans.py
@@ -65,7 +65,9 @@ def create(
account_id: str,
*,
url: str,
+ customagent: str | NotGiven = NOT_GIVEN,
custom_headers: Dict[str, str] | NotGiven = NOT_GIVEN,
+ referer: str | NotGiven = NOT_GIVEN,
screenshots_resolutions: List[Literal["desktop", "mobile", "tablet"]] | NotGiven = NOT_GIVEN,
visibility: Literal["Public", "Unlisted"] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -74,11 +76,10 @@ def create(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> ScanCreateResponse:
+ ) -> str:
"""Submit a URL to scan.
- You can also set some options, like the visibility level
- and custom headers. Check limits at
+ Check limits at
https://developers.cloudflare.com/security-center/investigate/scan-limits/.
Args:
@@ -105,11 +106,13 @@ def create(
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return self._post(
- f"/accounts/{account_id}/urlscanner/scan",
+ f"/accounts/{account_id}/urlscanner/v2/scan",
body=maybe_transform(
{
"url": url,
+ "customagent": customagent,
"custom_headers": custom_headers,
+ "referer": referer,
"screenshots_resolutions": screenshots_resolutions,
"visibility": visibility,
},
@@ -122,7 +125,7 @@ def create(
timeout=timeout,
post_parser=ResultWrapper[ScanCreateResponse]._unwrapper,
),
- cast_to=cast(Type[ScanCreateResponse], ResultWrapper[ScanCreateResponse]),
+ cast_to=cast(Type[str], ResultWrapper[str]),
)
def list(
@@ -415,7 +418,9 @@ async def create(
account_id: str,
*,
url: str,
+ customagent: str | NotGiven = NOT_GIVEN,
custom_headers: Dict[str, str] | NotGiven = NOT_GIVEN,
+ referer: str | NotGiven = NOT_GIVEN,
screenshots_resolutions: List[Literal["desktop", "mobile", "tablet"]] | NotGiven = NOT_GIVEN,
visibility: Literal["Public", "Unlisted"] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -424,11 +429,10 @@ async def create(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> ScanCreateResponse:
+ ) -> str:
"""Submit a URL to scan.
- You can also set some options, like the visibility level
- and custom headers. Check limits at
+ Check limits at
https://developers.cloudflare.com/security-center/investigate/scan-limits/.
Args:
@@ -455,11 +459,13 @@ async def create(
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return await self._post(
- f"/accounts/{account_id}/urlscanner/scan",
+ f"/accounts/{account_id}/urlscanner/v2/scan",
body=await async_maybe_transform(
{
"url": url,
+ "customagent": customagent,
"custom_headers": custom_headers,
+ "referer": referer,
"screenshots_resolutions": screenshots_resolutions,
"visibility": visibility,
},
@@ -472,7 +478,7 @@ async def create(
timeout=timeout,
post_parser=ResultWrapper[ScanCreateResponse]._unwrapper,
),
- cast_to=cast(Type[ScanCreateResponse], ResultWrapper[ScanCreateResponse]),
+ cast_to=cast(Type[str], ResultWrapper[str]),
)
async def list(
diff --git a/src/cloudflare/types/url_scanner/scan_create_params.py b/src/cloudflare/types/url_scanner/scan_create_params.py
index 3fac0ea2082..16a71092669 100644
--- a/src/cloudflare/types/url_scanner/scan_create_params.py
+++ b/src/cloudflare/types/url_scanner/scan_create_params.py
@@ -13,9 +13,13 @@
class ScanCreateParams(TypedDict, total=False):
url: Required[str]
+ customagent: str
+
custom_headers: Annotated[Dict[str, str], PropertyInfo(alias="customHeaders")]
"""Set custom headers."""
+ referer: str
+
screenshots_resolutions: Annotated[
List[Literal["desktop", "mobile", "tablet"]], PropertyInfo(alias="screenshotsResolutions")
]
diff --git a/src/cloudflare/types/url_scanner/scan_create_response.py b/src/cloudflare/types/url_scanner/scan_create_response.py
index df5609b4ebe..4534ad1039a 100644
--- a/src/cloudflare/types/url_scanner/scan_create_response.py
+++ b/src/cloudflare/types/url_scanner/scan_create_response.py
@@ -1,21 +1,7 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-from datetime import datetime
-
-from ..._models import BaseModel
+from typing_extensions import TypeAlias
__all__ = ["ScanCreateResponse"]
-
-class ScanCreateResponse(BaseModel):
- time: datetime
- """Time when url was submitted for scanning."""
-
- url: str
- """Canonical form of submitted URL. Use this if you want to later search by URL."""
-
- uuid: str
- """Scan ID."""
-
- visibility: str
- """Submitted visibility status."""
+ScanCreateResponse: TypeAlias = str
diff --git a/tests/api_resources/url_scanner/test_scans.py b/tests/api_resources/url_scanner/test_scans.py
index ff6e9eeb6f2..6845d3537c0 100644
--- a/tests/api_resources/url_scanner/test_scans.py
+++ b/tests/api_resources/url_scanner/test_scans.py
@@ -22,7 +22,6 @@
ScanGetResponse,
ScanHARResponse,
ScanListResponse,
- ScanCreateResponse,
)
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
@@ -37,18 +36,20 @@ def test_method_create(self, client: Cloudflare) -> None:
account_id="accountId",
url="https://www.example.com",
)
- assert_matches_type(ScanCreateResponse, scan, path=["response"])
+ assert_matches_type(str, scan, path=["response"])
@parametrize
def test_method_create_with_all_params(self, client: Cloudflare) -> None:
scan = client.url_scanner.scans.create(
account_id="accountId",
url="https://www.example.com",
+ customagent="customagent",
custom_headers={"foo": "string"},
+ referer="referer",
screenshots_resolutions=["desktop"],
visibility="Public",
)
- assert_matches_type(ScanCreateResponse, scan, path=["response"])
+ assert_matches_type(str, scan, path=["response"])
@parametrize
def test_raw_response_create(self, client: Cloudflare) -> None:
@@ -60,7 +61,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
scan = response.parse()
- assert_matches_type(ScanCreateResponse, scan, path=["response"])
+ assert_matches_type(str, scan, path=["response"])
@parametrize
def test_streaming_response_create(self, client: Cloudflare) -> None:
@@ -72,7 +73,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
scan = response.parse()
- assert_matches_type(ScanCreateResponse, scan, path=["response"])
+ assert_matches_type(str, scan, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -344,18 +345,20 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None:
account_id="accountId",
url="https://www.example.com",
)
- assert_matches_type(ScanCreateResponse, scan, path=["response"])
+ assert_matches_type(str, scan, path=["response"])
@parametrize
async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None:
scan = await async_client.url_scanner.scans.create(
account_id="accountId",
url="https://www.example.com",
+ customagent="customagent",
custom_headers={"foo": "string"},
+ referer="referer",
screenshots_resolutions=["desktop"],
visibility="Public",
)
- assert_matches_type(ScanCreateResponse, scan, path=["response"])
+ assert_matches_type(str, scan, path=["response"])
@parametrize
async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None:
@@ -367,7 +370,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
scan = await response.parse()
- assert_matches_type(ScanCreateResponse, scan, path=["response"])
+ assert_matches_type(str, scan, path=["response"])
@parametrize
async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None:
@@ -379,7 +382,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) ->
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
scan = await response.parse()
- assert_matches_type(ScanCreateResponse, scan, path=["response"])
+ assert_matches_type(str, scan, path=["response"])
assert cast(Any, response.is_closed) is True