Class WebRiskServiceV1Beta1Client (0.3.3)

WebRiskServiceV1Beta1Client(
    transport=None,
    channel=None,
    credentials=None,
    client_config=None,
    client_info=None,
    client_options=None,
)

Web Risk v1beta1 API defines an interface to detect malicious URLs on your website and in client applications.

Methods

WebRiskServiceV1Beta1Client

WebRiskServiceV1Beta1Client(
    transport=None,
    channel=None,
    credentials=None,
    client_config=None,
    client_info=None,
    client_options=None,
)

Constructor.

Parameters
NameDescription
channel grpc.Channel

DEPRECATED. A Channel instance through which to make calls. This argument is mutually exclusive with credentials; providing both will raise an exception.

credentials google.auth.credentials.Credentials

The authorization credentials to attach to requests. These credentials identify this application to the service. If none are specified, the client will attempt to ascertain the credentials from the environment. This argument is mutually exclusive with providing a transport instance to transport; doing so will raise an exception.

client_config dict

DEPRECATED. A dictionary of call options for each method. If not specified, the default configuration is used.

client_info google.api_core.gapic_v1.client_info.ClientInfo

The client info used to send a user-agent string along with API requests. If None, then default info will be used. Generally, you only need to set this if you're developing your own client library.

client_options Union[dict, google.api_core.client_options.ClientOptions]

Client options used to set user options on the client. API Endpoint should be set through client_options.

compute_threat_list_diff

compute_threat_list_diff(threat_type, constraints, version_token=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)

Gets the most recent threat list diffs.

.. rubric:: Example

from google.cloud import webrisk_v1beta1 from google.cloud.webrisk_v1beta1 import enums

client = webrisk_v1beta1.WebRiskServiceV1Beta1Client()

TODO: Initialize threat_type:

threat_type = enums.ThreatType.THREAT_TYPE_UNSPECIFIED

TODO: Initialize constraints:

constraints = {}

response = client.compute_threat_list_diff(threat_type, constraints)

Parameters
NameDescription
threat_type ThreatType

The ThreatList to update.

constraints Union[dict, Constraints]

Required. The constraints associated with this request. If a dict is provided, it must be of the same form as the protobuf message Constraints

version_token bytes

The current version token of the client for the requested list (the client version that was received from the last successful diff).

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf the parameters are invalid.

from_service_account_file

from_service_account_file(filename, *args, **kwargs)

Creates an instance of this client using the provided credentials file.

Parameter
NameDescription
filename str

The path to the service account private key json file.

Returns
TypeDescription
WebRiskServiceV1Beta1ClientThe constructed client.

from_service_account_json

from_service_account_json(filename, *args, **kwargs)

Creates an instance of this client using the provided credentials file.

Parameter
NameDescription
filename str

The path to the service account private key json file.

Returns
TypeDescription
WebRiskServiceV1Beta1ClientThe constructed client.

search_hashes

search_hashes(threat_types, hash_prefix=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)

Gets the full hashes that match the requested hash prefix. This is used after a hash prefix is looked up in a threatList and there is a match. The client side threatList only holds partial hashes so the client must query this method to determine if there is a full hash match of a threat.

.. rubric:: Example

from google.cloud import webrisk_v1beta1 from google.cloud.webrisk_v1beta1 import enums

client = webrisk_v1beta1.WebRiskServiceV1Beta1Client()

TODO: Initialize threat_types:

threat_types = []

response = client.search_hashes(threat_types)

Parameters
NameDescription
threat_types list[ThreatType]

Required. The ThreatLists to search in.

hash_prefix bytes

A hash prefix, consisting of the most significant 4-32 bytes of a SHA256 hash. For JSON requests, this field is base64-encoded.

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf the parameters are invalid.

search_uris

search_uris(uri, threat_types, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)

This method is used to check whether a URI is on a given threatList.

.. rubric:: Example

from google.cloud import webrisk_v1beta1 from google.cloud.webrisk_v1beta1 import enums

client = webrisk_v1beta1.WebRiskServiceV1Beta1Client()

TODO: Initialize uri:

uri = ''

TODO: Initialize threat_types:

threat_types = []

response = client.search_uris(uri, threat_types)

Parameters
NameDescription
uri str

Required. The URI to be checked for matches.

threat_types list[ThreatType]

Required. The ThreatLists to search in.

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf the parameters are invalid.