Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 1475
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-663ea50351c42f1c51f49f099c888745f6a06cf22b8fe46cf1fa9ae89fdfdd61.yml
configured_endpoints: 1483
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-f9dc65d353b377858f3d63d594de47559ed3a9d562295719690867315b8ec2fe.yml
45 changes: 45 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -6594,6 +6594,51 @@ Methods:
- <code title="get /accounts/{account_id}/vectorize/v2/indexes/{index_name}/metadata_index/list">client.vectorize.indexes.metadata_index.<a href="./src/cloudflare/resources/vectorize/indexes/metadata_index.py">list</a>(index_name, \*, account_id) -> <a href="./src/cloudflare/types/vectorize/indexes/metadata_index_list_response.py">Optional[MetadataIndexListResponse]</a></code>
- <code title="post /accounts/{account_id}/vectorize/v2/indexes/{index_name}/metadata_index/delete">client.vectorize.indexes.metadata_index.<a href="./src/cloudflare/resources/vectorize/indexes/metadata_index.py">delete</a>(index_name, \*, account_id, \*\*<a href="src/cloudflare/types/vectorize/indexes/metadata_index_delete_params.py">params</a>) -> <a href="./src/cloudflare/types/vectorize/indexes/metadata_index_delete_response.py">Optional[MetadataIndexDeleteResponse]</a></code>

# URLScanner

Types:

```python
from cloudflare.types.url_scanner import URLScannerDomain, URLScannerTask
```

## Responses

Types:

```python
from cloudflare.types.url_scanner import ResponseGetResponse
```

Methods:

- <code title="get /accounts/{account_id}/urlscanner/v2/responses/{response_id}">client.url_scanner.responses.<a href="./src/cloudflare/resources/url_scanner/responses.py">get</a>(response_id, \*, account_id) -> str</code>

## Scans

Types:

```python
from cloudflare.types.url_scanner import (
ScanCreateResponse,
ScanListResponse,
ScanBulkCreateResponse,
ScanDOMResponse,
ScanGetResponse,
ScanHARResponse,
)
```

Methods:

- <code title="post /accounts/{account_id}/urlscanner/v2/scan">client.url_scanner.scans.<a href="./src/cloudflare/resources/url_scanner/scans.py">create</a>(\*, account_id, \*\*<a href="src/cloudflare/types/url_scanner/scan_create_params.py">params</a>) -> <a href="./src/cloudflare/types/url_scanner/scan_create_response.py">str</a></code>
- <code title="get /accounts/{account_id}/urlscanner/v2/search">client.url_scanner.scans.<a href="./src/cloudflare/resources/url_scanner/scans.py">list</a>(\*, account_id, \*\*<a href="src/cloudflare/types/url_scanner/scan_list_params.py">params</a>) -> <a href="./src/cloudflare/types/url_scanner/scan_list_response.py">ScanListResponse</a></code>
- <code title="post /accounts/{account_id}/urlscanner/v2/bulk">client.url_scanner.scans.<a href="./src/cloudflare/resources/url_scanner/scans.py">bulk_create</a>(\*, account_id, \*\*<a href="src/cloudflare/types/url_scanner/scan_bulk_create_params.py">params</a>) -> <a href="./src/cloudflare/types/url_scanner/scan_bulk_create_response.py">ScanBulkCreateResponse</a></code>
- <code title="get /accounts/{account_id}/urlscanner/v2/dom/{scan_id}">client.url_scanner.scans.<a href="./src/cloudflare/resources/url_scanner/scans.py">dom</a>(scan_id, \*, account_id) -> str</code>
- <code title="get /accounts/{account_id}/urlscanner/v2/result/{scan_id}">client.url_scanner.scans.<a href="./src/cloudflare/resources/url_scanner/scans.py">get</a>(scan_id, \*, account_id) -> <a href="./src/cloudflare/types/url_scanner/scan_get_response.py">ScanGetResponse</a></code>
- <code title="get /accounts/{account_id}/urlscanner/v2/har/{scan_id}">client.url_scanner.scans.<a href="./src/cloudflare/resources/url_scanner/scans.py">har</a>(scan_id, \*, account_id) -> <a href="./src/cloudflare/types/url_scanner/scan_har_response.py">ScanHARResponse</a></code>
- <code title="get /accounts/{account_id}/urlscanner/v2/screenshots/{scan_id}.png">client.url_scanner.scans.<a href="./src/cloudflare/resources/url_scanner/scans.py">screenshot</a>(scan_id, \*, account_id, \*\*<a href="src/cloudflare/types/url_scanner/scan_screenshot_params.py">params</a>) -> BinaryAPIResponse</code>

# Radar

## AI
Expand Down
38 changes: 38 additions & 0 deletions src/cloudflare/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
memberships,
page_shield,
rate_limits,
url_scanner,
dns_firewall,
healthchecks,
security_txt,
Expand Down Expand Up @@ -185,6 +186,7 @@
from .resources.botnet_feed.botnet_feed import BotnetFeedResource, AsyncBotnetFeedResource
from .resources.diagnostics.diagnostics import DiagnosticsResource, AsyncDiagnosticsResource
from .resources.page_shield.page_shield import PageShieldResource, AsyncPageShieldResource
from .resources.url_scanner.url_scanner import URLScannerResource, AsyncURLScannerResource
from .resources.dns_firewall.dns_firewall import DNSFirewallResource, AsyncDNSFirewallResource
from .resources.healthchecks.healthchecks import HealthchecksResource, AsyncHealthchecksResource
from .resources.email_routing.email_routing import EmailRoutingResource, AsyncEmailRoutingResource
Expand Down Expand Up @@ -704,6 +706,12 @@ def vectorize(self) -> VectorizeResource:

return VectorizeResource(self)

@cached_property
def url_scanner(self) -> URLScannerResource:
from .resources.url_scanner import URLScannerResource

return URLScannerResource(self)

@cached_property
def radar(self) -> RadarResource:
from .resources.radar import RadarResource
Expand Down Expand Up @@ -1469,6 +1477,12 @@ def vectorize(self) -> AsyncVectorizeResource:

return AsyncVectorizeResource(self)

@cached_property
def url_scanner(self) -> AsyncURLScannerResource:
from .resources.url_scanner import AsyncURLScannerResource

return AsyncURLScannerResource(self)

@cached_property
def radar(self) -> AsyncRadarResource:
from .resources.radar import AsyncRadarResource
Expand Down Expand Up @@ -2167,6 +2181,12 @@ def vectorize(self) -> vectorize.VectorizeResourceWithRawResponse:

return VectorizeResourceWithRawResponse(self._client.vectorize)

@cached_property
def url_scanner(self) -> url_scanner.URLScannerResourceWithRawResponse:
from .resources.url_scanner import URLScannerResourceWithRawResponse

return URLScannerResourceWithRawResponse(self._client.url_scanner)

@cached_property
def radar(self) -> radar.RadarResourceWithRawResponse:
from .resources.radar import RadarResourceWithRawResponse
Expand Down Expand Up @@ -2686,6 +2706,12 @@ def vectorize(self) -> vectorize.AsyncVectorizeResourceWithRawResponse:

return AsyncVectorizeResourceWithRawResponse(self._client.vectorize)

@cached_property
def url_scanner(self) -> url_scanner.AsyncURLScannerResourceWithRawResponse:
from .resources.url_scanner import AsyncURLScannerResourceWithRawResponse

return AsyncURLScannerResourceWithRawResponse(self._client.url_scanner)

@cached_property
def radar(self) -> radar.AsyncRadarResourceWithRawResponse:
from .resources.radar import AsyncRadarResourceWithRawResponse
Expand Down Expand Up @@ -3205,6 +3231,12 @@ def vectorize(self) -> vectorize.VectorizeResourceWithStreamingResponse:

return VectorizeResourceWithStreamingResponse(self._client.vectorize)

@cached_property
def url_scanner(self) -> url_scanner.URLScannerResourceWithStreamingResponse:
from .resources.url_scanner import URLScannerResourceWithStreamingResponse

return URLScannerResourceWithStreamingResponse(self._client.url_scanner)

@cached_property
def radar(self) -> radar.RadarResourceWithStreamingResponse:
from .resources.radar import RadarResourceWithStreamingResponse
Expand Down Expand Up @@ -3728,6 +3760,12 @@ def vectorize(self) -> vectorize.AsyncVectorizeResourceWithStreamingResponse:

return AsyncVectorizeResourceWithStreamingResponse(self._client.vectorize)

@cached_property
def url_scanner(self) -> url_scanner.AsyncURLScannerResourceWithStreamingResponse:
from .resources.url_scanner import AsyncURLScannerResourceWithStreamingResponse

return AsyncURLScannerResourceWithStreamingResponse(self._client.url_scanner)

@cached_property
def radar(self) -> radar.AsyncRadarResourceWithStreamingResponse:
from .resources.radar import AsyncRadarResourceWithStreamingResponse
Expand Down
47 changes: 47 additions & 0 deletions src/cloudflare/resources/url_scanner/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from .scans import (
ScansResource,
AsyncScansResource,
ScansResourceWithRawResponse,
AsyncScansResourceWithRawResponse,
ScansResourceWithStreamingResponse,
AsyncScansResourceWithStreamingResponse,
)
from .responses import (
ResponsesResource,
AsyncResponsesResource,
ResponsesResourceWithRawResponse,
AsyncResponsesResourceWithRawResponse,
ResponsesResourceWithStreamingResponse,
AsyncResponsesResourceWithStreamingResponse,
)
from .url_scanner import (
URLScannerResource,
AsyncURLScannerResource,
URLScannerResourceWithRawResponse,
AsyncURLScannerResourceWithRawResponse,
URLScannerResourceWithStreamingResponse,
AsyncURLScannerResourceWithStreamingResponse,
)

__all__ = [
"ResponsesResource",
"AsyncResponsesResource",
"ResponsesResourceWithRawResponse",
"AsyncResponsesResourceWithRawResponse",
"ResponsesResourceWithStreamingResponse",
"AsyncResponsesResourceWithStreamingResponse",
"ScansResource",
"AsyncScansResource",
"ScansResourceWithRawResponse",
"AsyncScansResourceWithRawResponse",
"ScansResourceWithStreamingResponse",
"AsyncScansResourceWithStreamingResponse",
"URLScannerResource",
"AsyncURLScannerResource",
"URLScannerResourceWithRawResponse",
"AsyncURLScannerResourceWithRawResponse",
"URLScannerResourceWithStreamingResponse",
"AsyncURLScannerResourceWithStreamingResponse",
]
182 changes: 182 additions & 0 deletions src/cloudflare/resources/url_scanner/responses.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

import httpx

from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
from ..._response import (
to_raw_response_wrapper,
to_streamed_response_wrapper,
async_to_raw_response_wrapper,
async_to_streamed_response_wrapper,
)
from ..._base_client import make_request_options

__all__ = ["ResponsesResource", "AsyncResponsesResource"]


class ResponsesResource(SyncAPIResource):
@cached_property
def with_raw_response(self) -> ResponsesResourceWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return the
the raw response object instead of the parsed content.

For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
"""
return ResponsesResourceWithRawResponse(self)

@cached_property
def with_streaming_response(self) -> ResponsesResourceWithStreamingResponse:
"""
An alternative to `.with_raw_response` that doesn't eagerly read the response body.

For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
"""
return ResponsesResourceWithStreamingResponse(self)

def get(
self,
response_id: str,
*,
account_id: str,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> str:
"""Returns the raw response of the network request.

If HTML, a plain text response
will be returned.

Args:
account_id: Account ID.

response_id: Response hash.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not response_id:
raise ValueError(f"Expected a non-empty value for `response_id` but received {response_id!r}")
extra_headers = {"Accept": "text/plain", **(extra_headers or {})}
return self._get(
f"/accounts/{account_id}/urlscanner/v2/responses/{response_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=str,
)


class AsyncResponsesResource(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncResponsesResourceWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return the
the raw response object instead of the parsed content.

For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
"""
return AsyncResponsesResourceWithRawResponse(self)

@cached_property
def with_streaming_response(self) -> AsyncResponsesResourceWithStreamingResponse:
"""
An alternative to `.with_raw_response` that doesn't eagerly read the response body.

For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
"""
return AsyncResponsesResourceWithStreamingResponse(self)

async def get(
self,
response_id: str,
*,
account_id: str,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> str:
"""Returns the raw response of the network request.

If HTML, a plain text response
will be returned.

Args:
account_id: Account ID.

response_id: Response hash.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not response_id:
raise ValueError(f"Expected a non-empty value for `response_id` but received {response_id!r}")
extra_headers = {"Accept": "text/plain", **(extra_headers or {})}
return await self._get(
f"/accounts/{account_id}/urlscanner/v2/responses/{response_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=str,
)


class ResponsesResourceWithRawResponse:
def __init__(self, responses: ResponsesResource) -> None:
self._responses = responses

self.get = to_raw_response_wrapper(
responses.get,
)


class AsyncResponsesResourceWithRawResponse:
def __init__(self, responses: AsyncResponsesResource) -> None:
self._responses = responses

self.get = async_to_raw_response_wrapper(
responses.get,
)


class ResponsesResourceWithStreamingResponse:
def __init__(self, responses: ResponsesResource) -> None:
self._responses = responses

self.get = to_streamed_response_wrapper(
responses.get,
)


class AsyncResponsesResourceWithStreamingResponse:
def __init__(self, responses: AsyncResponsesResource) -> None:
self._responses = responses

self.get = async_to_streamed_response_wrapper(
responses.get,
)
Loading