Client for Google Cloud Recaptchaenterprise API

class google.cloud.recaptchaenterprise_v1.AndroidKeySettings(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Settings specific to keys that can be used by Android apps.

allowed_package_names()

Android package names of apps allowed to use the key. Example: ‘com.companyname.appname’

  • Type

    Sequence[str]

_delattr_(key)

Delete the value on the given field.

This is generally equivalent to setting a falsy value.

_eq_(other)

Return True if the messages are equal, False otherwise.

_ne_(other)

Return True if the messages are unequal, False otherwise.

_setattr_(key, value)

Set the value on the given field.

For well-known protocol buffer types which are marshalled, either the protocol buffer object or the Python equivalent is accepted.

class google.cloud.recaptchaenterprise_v1.AnnotateAssessmentRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)

The request message to annotate an Assessment.

name()

Required. The resource name of the Assessment, in the format “projects/{project}/assessments/{assessment}”.

annotation()

Required. The annotation that will be assigned to the Event.

  • Type

    Annotation

class Annotation(value)

Enum that reprensents the types of annotations.

_delattr_(key)

Delete the value on the given field.

This is generally equivalent to setting a falsy value.

_eq_(other)

Return True if the messages are equal, False otherwise.

_ne_(other)

Return True if the messages are unequal, False otherwise.

_setattr_(key, value)

Set the value on the given field.

For well-known protocol buffer types which are marshalled, either the protocol buffer object or the Python equivalent is accepted.

class google.cloud.recaptchaenterprise_v1.AnnotateAssessmentResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Empty response for AnnotateAssessment.

_delattr_(key)

Delete the value on the given field.

This is generally equivalent to setting a falsy value.

_eq_(other)

Return True if the messages are equal, False otherwise.

_ne_(other)

Return True if the messages are unequal, False otherwise.

_setattr_(key, value)

Set the value on the given field.

For well-known protocol buffer types which are marshalled, either the protocol buffer object or the Python equivalent is accepted.

class google.cloud.recaptchaenterprise_v1.Assessment(mapping=None, *, ignore_unknown_fields=False, **kwargs)

A recaptcha assessment resource.

name()

Output only. The resource name for the Assessment in the format “projects/{project}/assessments/{assessment}”.

event()

The event being assessed.

  • Type

    Event

risk_analysis()

Output only. The risk analysis result for the event being assessed.

  • Type

    RiskAnalysis

token_properties()

Output only. Properties of the provided event token.

  • Type

    TokenProperties

_delattr_(key)

Delete the value on the given field.

This is generally equivalent to setting a falsy value.

_eq_(other)

Return True if the messages are equal, False otherwise.

_ne_(other)

Return True if the messages are unequal, False otherwise.

_setattr_(key, value)

Set the value on the given field.

For well-known protocol buffer types which are marshalled, either the protocol buffer object or the Python equivalent is accepted.

class google.cloud.recaptchaenterprise_v1.CreateAssessmentRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)

The create assessment request message.

parent()

Required. The name of the project in which the assessment will be created, in the format “projects/{project}”.

assessment()

Required. The assessment details.

  • Type

    Assessment

_delattr_(key)

Delete the value on the given field.

This is generally equivalent to setting a falsy value.

_eq_(other)

Return True if the messages are equal, False otherwise.

_ne_(other)

Return True if the messages are unequal, False otherwise.

_setattr_(key, value)

Set the value on the given field.

For well-known protocol buffer types which are marshalled, either the protocol buffer object or the Python equivalent is accepted.

class google.cloud.recaptchaenterprise_v1.CreateKeyRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)

The create key request message.

parent()

Required. The name of the project in which the key will be created, in the format “projects/{project}”.

key()

Required. Information to create a reCAPTCHA Enterprise key.

  • Type

    Key

_delattr_(key)

Delete the value on the given field.

This is generally equivalent to setting a falsy value.

_eq_(other)

Return True if the messages are equal, False otherwise.

_ne_(other)

Return True if the messages are unequal, False otherwise.

_setattr_(key, value)

Set the value on the given field.

For well-known protocol buffer types which are marshalled, either the protocol buffer object or the Python equivalent is accepted.

class google.cloud.recaptchaenterprise_v1.DeleteKeyRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)

The delete key request message.

name()

Required. The name of the key to be deleted, in the format “projects/{project}/keys/{key}”.

_delattr_(key)

Delete the value on the given field.

This is generally equivalent to setting a falsy value.

_eq_(other)

Return True if the messages are equal, False otherwise.

_ne_(other)

Return True if the messages are unequal, False otherwise.

_setattr_(key, value)

Set the value on the given field.

For well-known protocol buffer types which are marshalled, either the protocol buffer object or the Python equivalent is accepted.

class google.cloud.recaptchaenterprise_v1.Event(mapping=None, *, ignore_unknown_fields=False, **kwargs)

token()

Optional. The user response token provided by the reCAPTCHA client-side integration on your site.

site_key()

Optional. The site key that was used to invoke reCAPTCHA on your site and generate the token.

user_agent()

Optional. The user agent present in the request from the user’s device related to this event.

user_ip_address()

Optional. The IP address in the request from the user’s device related to this event.

expected_action()

Optional. The expected action for this type of event. This should be the same action provided at token generation time on client-side platforms already integrated with recaptcha enterprise.

_delattr_(key)

Delete the value on the given field.

This is generally equivalent to setting a falsy value.

_eq_(other)

Return True if the messages are equal, False otherwise.

_ne_(other)

Return True if the messages are unequal, False otherwise.

_setattr_(key, value)

Set the value on the given field.

For well-known protocol buffer types which are marshalled, either the protocol buffer object or the Python equivalent is accepted.

class google.cloud.recaptchaenterprise_v1.GetKeyRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)

The get key request message.

name()

Required. The name of the requested key, in the format “projects/{project}/keys/{key}”.

_delattr_(key)

Delete the value on the given field.

This is generally equivalent to setting a falsy value.

_eq_(other)

Return True if the messages are equal, False otherwise.

_ne_(other)

Return True if the messages are unequal, False otherwise.

_setattr_(key, value)

Set the value on the given field.

For well-known protocol buffer types which are marshalled, either the protocol buffer object or the Python equivalent is accepted.

class google.cloud.recaptchaenterprise_v1.IOSKeySettings(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Settings specific to keys that can be used by iOS apps.

allowed_bundle_ids()

iOS bundle ids of apps allowed to use the key. Example: ‘com.companyname.productname.appname’

  • Type

    Sequence[str]

_delattr_(key)

Delete the value on the given field.

This is generally equivalent to setting a falsy value.

_eq_(other)

Return True if the messages are equal, False otherwise.

_ne_(other)

Return True if the messages are unequal, False otherwise.

_setattr_(key, value)

Set the value on the given field.

For well-known protocol buffer types which are marshalled, either the protocol buffer object or the Python equivalent is accepted.

class google.cloud.recaptchaenterprise_v1.Key(mapping=None, *, ignore_unknown_fields=False, **kwargs)

A key used to identify and configure applications (web and/or mobile) that use reCAPTCHA Enterprise.

name()

The resource name for the Key in the format “projects/{project}/keys/{key}”.

display_name()

Human-readable display name of this key. Modifiable by user.

web_settings()

Settings for keys that can be used by websites.

  • Type

    WebKeySettings

android_settings()

Settings for keys that can be used by Android apps.

  • Type

    AndroidKeySettings

ios_settings()

Settings for keys that can be used by iOS apps.

  • Type

    IOSKeySettings

labels()

Optional. See a href=”[https://cloud.google.com/recaptcha](https://cloud.google.com/recaptcha)- enterprise/docs/labels” Creating and managing labels.

  • Type

    Sequence[LabelsEntry]

create_time()

The timestamp corresponding to the creation of this Key.

  • Type

    Timestamp

class LabelsEntry(mapping=None, *, ignore_unknown_fields=False, **kwargs)

_delattr_(key)

Delete the value on the given field.

This is generally equivalent to setting a falsy value.

_eq_(other)

Return True if the messages are equal, False otherwise.

_ne_(other)

Return True if the messages are unequal, False otherwise.

_setattr_(key, value)

Set the value on the given field.

For well-known protocol buffer types which are marshalled, either the protocol buffer object or the Python equivalent is accepted.

_delattr_(key)

Delete the value on the given field.

This is generally equivalent to setting a falsy value.

_eq_(other)

Return True if the messages are equal, False otherwise.

_ne_(other)

Return True if the messages are unequal, False otherwise.

_setattr_(key, value)

Set the value on the given field.

For well-known protocol buffer types which are marshalled, either the protocol buffer object or the Python equivalent is accepted.

class google.cloud.recaptchaenterprise_v1.ListKeysRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)

The list keys request message.

parent()

Required. The name of the project that contains the keys that will be listed, in the format “projects/{project}”.

page_size()

Optional. The maximum number of keys to return. Default is 10. Max limit is 1000.

page_token()

Optional. The next_page_token value returned from a previous. ListKeysRequest, if any.

_delattr_(key)

Delete the value on the given field.

This is generally equivalent to setting a falsy value.

_eq_(other)

Return True if the messages are equal, False otherwise.

_ne_(other)

Return True if the messages are unequal, False otherwise.

_setattr_(key, value)

Set the value on the given field.

For well-known protocol buffer types which are marshalled, either the protocol buffer object or the Python equivalent is accepted.

class google.cloud.recaptchaenterprise_v1.ListKeysResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Response to request to list keys in a project.

keys()

Key details.

  • Type

    Sequence[Key]

next_page_token()

Token to retrieve the next page of results. It is set to empty if no keys remain in results.

_delattr_(key)

Delete the value on the given field.

This is generally equivalent to setting a falsy value.

_eq_(other)

Return True if the messages are equal, False otherwise.

_ne_(other)

Return True if the messages are unequal, False otherwise.

_setattr_(key, value)

Set the value on the given field.

For well-known protocol buffer types which are marshalled, either the protocol buffer object or the Python equivalent is accepted.

class google.cloud.recaptchaenterprise_v1.RecaptchaEnterpriseServiceClient(*, credentials: google.auth.credentials.Credentials = None, transport: Union[str, google.cloud.recaptchaenterprise_v1.services.recaptcha_enterprise_service.transports.base.RecaptchaEnterpriseServiceTransport] = None, client_options: <module 'google.api_core.client_options' from '/workspace/python-recaptcha-enterprise/.nox/docfx/lib/python3.9/site-packages/google/api_core/client_options.py'> = None)

Service to determine the likelihood an event is legitimate.

Instantiate the recaptcha enterprise service client.

  • Parameters

    • credentials (Optional[google.auth.credentials.Credentials]) – The authorization credentials to attach to requests. These credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment.

    • transport (Union[str, **RecaptchaEnterpriseServiceTransport]) – The transport to use. If set to None, a transport is chosen automatically.

    • client_options (ClientOptions) – Custom options for the client. (1) The api_endpoint property can be used to override the default endpoint provided by the client. (2) If transport argument is None, client_options can be used to create a mutual TLS transport. If client_cert_source is provided, mutual TLS transport will be created with the given api_endpoint or the default mTLS endpoint, and the client SSL credentials obtained from client_cert_source.

  • Raises

    google.auth.exceptions.MutualTlsChannelError – If mutual TLS transport creation failed for any reason.

annotate_assessment(request: Optional[google.cloud.recaptchaenterprise_v1.types.recaptchaenterprise.AnnotateAssessmentRequest] = None, *, name: Optional[str] = None, annotation: Optional[google.cloud.recaptchaenterprise_v1.types.recaptchaenterprise.AnnotateAssessmentRequest.Annotation] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE:

Annotates a previously created Assessment to provide additional information on whether the event turned out to be authentic or fradulent.

  • Parameters

    • request (AnnotateAssessmentRequest) – The request object. The request message to annotate an Assessment.

    • name (str) – Required. The resource name of the Assessment, in the format “projects/{project}/assessments/{assessment}”. This corresponds to the name field on the request instance; if request is provided, this should not be set.

    • annotation (Annotation) – Required. The annotation that will be assigned to the Event. This corresponds to the annotation field on the request instance; if request is provided, this should not be set.

    • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

    • timeout (float) – The timeout for this request.

    • metadata (Sequence[Tuple[str, *[str](https://python.readthedocs.io/en/latest/library/stdtypes.html#str)]*]) – Strings which should be sent along with the request as metadata.

  • Returns

    Empty response for AnnotateAssessment.

  • Return type

    AnnotateAssessmentResponse

static assessment_path(project: str, assessment: str)

Return a fully-qualified assessment string.

create_assessment(request: Optional[google.cloud.recaptchaenterprise_v1.types.recaptchaenterprise.CreateAssessmentRequest] = None, *, parent: Optional[str] = None, assessment: Optional[google.cloud.recaptchaenterprise_v1.types.recaptchaenterprise.Assessment] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE:

Creates an Assessment of the likelihood an event is legitimate.

  • Parameters

    • request (CreateAssessmentRequest) – The request object. The create assessment request message.

    • parent (str) – Required. The name of the project in which the assessment will be created, in the format “projects/{project}”. This corresponds to the parent field on the request instance; if request is provided, this should not be set.

    • assessment (Assessment) – Required. The assessment details. This corresponds to the assessment field on the request instance; if request is provided, this should not be set.

    • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

    • timeout (float) – The timeout for this request.

    • metadata (Sequence[Tuple[str, *[str](https://python.readthedocs.io/en/latest/library/stdtypes.html#str)]*]) – Strings which should be sent along with the request as metadata.

  • Returns

    A recaptcha assessment resource.

  • Return type

    Assessment

create_key(request: Optional[google.cloud.recaptchaenterprise_v1.types.recaptchaenterprise.CreateKeyRequest] = None, *, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE:

Creates a new reCAPTCHA Enterprise key.

delete_key(request: Optional[google.cloud.recaptchaenterprise_v1.types.recaptchaenterprise.DeleteKeyRequest] = None, *, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE:

Deletes the specified key.

classmethod from_service_account_file(filename: str, *args, **kwargs)

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

  • Parameters

    • filename (str) – The path to the service account private key json file.

    • args – Additional arguments to pass to the constructor.

    • kwargs – Additional arguments to pass to the constructor.

  • Returns

    The constructed client.

  • Return type

    {@api.name}

classmethod from_service_account_json(filename: str, *args, **kwargs)

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

  • Parameters

    • filename (str) – The path to the service account private key json file.

    • args – Additional arguments to pass to the constructor.

    • kwargs – Additional arguments to pass to the constructor.

  • Returns

    The constructed client.

  • Return type

    {@api.name}

get_key(request: Optional[google.cloud.recaptchaenterprise_v1.types.recaptchaenterprise.GetKeyRequest] = None, *, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE:

Returns the specified key.

static key_path(project: str, key: str)

Return a fully-qualified key string.

list_keys(request: Optional[google.cloud.recaptchaenterprise_v1.types.recaptchaenterprise.ListKeysRequest] = None, *, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE:

Returns the list of all keys that belong to a project.

  • Parameters

  • Returns

    Response to request to list keys in a project. Iterating over this object will yield results and resolve additional pages automatically.

  • Return type

    ListKeysPager

static parse_assessment_path(path: str)

Parse a assessment path into its component segments.

static parse_key_path(path: str)

Parse a key path into its component segments.

update_key(request: Optional[google.cloud.recaptchaenterprise_v1.types.recaptchaenterprise.UpdateKeyRequest] = None, *, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE:

Updates the specified key.

class google.cloud.recaptchaenterprise_v1.RiskAnalysis(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Risk analysis result for an event.

score()

Legitimate event score from 0.0 to 1.0. (1.0 means very likely legitimate traffic while 0.0 means very likely non-legitimate traffic).

reasons()

Reasons contributing to the risk analysis verdict.

  • Type

    Sequence[ClassificationReason]

class ClassificationReason(value)

LINT.IfChange(classification_reason) Reasons contributing to the risk analysis verdict.

_delattr_(key)

Delete the value on the given field.

This is generally equivalent to setting a falsy value.

_eq_(other)

Return True if the messages are equal, False otherwise.

_ne_(other)

Return True if the messages are unequal, False otherwise.

_setattr_(key, value)

Set the value on the given field.

For well-known protocol buffer types which are marshalled, either the protocol buffer object or the Python equivalent is accepted.

class google.cloud.recaptchaenterprise_v1.TokenProperties(mapping=None, *, ignore_unknown_fields=False, **kwargs)

valid()

Whether the provided user response token is valid. When valid = false, the reason could be specified in invalid_reason or it could also be due to a user failing to solve a challenge or a sitekey mismatch (i.e the sitekey used to generate the token was different than the one specified in the assessment).

invalid_reason()

Reason associated with the response when valid = false.

  • Type

    InvalidReason

create_time()

The timestamp corresponding to the generation of the token.

  • Type

    Timestamp

hostname()

The hostname of the page on which the token was generated.

action()

Action name provided at token generation.

class InvalidReason(value)

LINT.IfChange Enum that represents the types of invalid token reasons.

_delattr_(key)

Delete the value on the given field.

This is generally equivalent to setting a falsy value.

_eq_(other)

Return True if the messages are equal, False otherwise.

_ne_(other)

Return True if the messages are unequal, False otherwise.

_setattr_(key, value)

Set the value on the given field.

For well-known protocol buffer types which are marshalled, either the protocol buffer object or the Python equivalent is accepted.

class google.cloud.recaptchaenterprise_v1.UpdateKeyRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)

The update key request message.

key()

Required. The key to update.

  • Type

    Key

update_mask()

Optional. The mask to control which field of the key get updated. If the mask is not present, all fields will be updated.

  • Type

    FieldMask

_delattr_(key)

Delete the value on the given field.

This is generally equivalent to setting a falsy value.

_eq_(other)

Return True if the messages are equal, False otherwise.

_ne_(other)

Return True if the messages are unequal, False otherwise.

_setattr_(key, value)

Set the value on the given field.

For well-known protocol buffer types which are marshalled, either the protocol buffer object or the Python equivalent is accepted.

class google.cloud.recaptchaenterprise_v1.WebKeySettings(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Settings specific to keys that can be used by websites.

allow_all_domains()

If set to true, it means allowed_domains will not be enforced.

allowed_domains()

Domains or subdomains of websites allowed to use the key. All subdomains of an allowed domain are automatically allowed. A valid domain requires a host and must not include any path, port, query or fragment. Examples: ‘example.com’ or ‘subdomain.example.com’

  • Type

    Sequence[str]

allow_amp_traffic()

Required. Whether this key can be used on AMP (Accelerated Mobile Pages) websites.

integration_type()

Required. Describes how this key is integrated with the website.

  • Type

    IntegrationType

challenge_security_preference()

Settings for the frequency and difficulty at which this key triggers captcha challenges. This should only be specified for IntegrationTypes CHECKBOX and INVISIBLE.

  • Type

    ChallengeSecurityPreference

class ChallengeSecurityPreference(value)

Enum that represents the possible challenge frequency and difficulty configurations for a web key.

class IntegrationType(value)

Enum that represents the integration types for web keys.

_delattr_(key)

Delete the value on the given field.

This is generally equivalent to setting a falsy value.

_eq_(other)

Return True if the messages are equal, False otherwise.

_ne_(other)

Return True if the messages are unequal, False otherwise.

_setattr_(key, value)

Set the value on the given field.

For well-known protocol buffer types which are marshalled, either the protocol buffer object or the Python equivalent is accepted.