From b3672ed54b1300a77077bc4ef9b296fd91987668 Mon Sep 17 00:00:00 2001 From: Sita Lakshmi Sangameswaran Date: Wed, 13 Oct 2021 17:03:00 +0530 Subject: [PATCH 01/63] docs(samples): add reCAPTCHA Enterprise code samples (#112) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs(samples): added samples and tests for site key CRUD operation * docs(samples): added samples and tests for create assessment * docs(samples): modified requirements and test inputs * docs(samples): lint fix - adding copyright * fix(samples): added nox config and modified requirements-test * docs(samples): lint fix * refactor(samples): updated nox file * docs(samples): lint fix * docs(samples): added nox config * docs(samples): lint fix; modified nox config * refactor(samples): incorporated review comments * refactor(samples): lint fix * refactor(samples): lint fix * refactor(samples): lint fix * docs(samples): updated to use latest chrome version and lint fix * fix(samples): updated selenium to use chrome browser and added display name to update key * build: add placeholder dockerfile, update kokoro configs * Adding chrome installation in docker * refactor(samples): removed webdriver manager dependency. Included commands to install binary file in docker. * fix(samples): changed the chromedriver version to latest release. * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * refactor(samples): included review comments Co-authored-by: Bu Sun Kim Co-authored-by: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> Co-authored-by: Anthonios Partheniou Co-authored-by: Owl Bot --- .../snippets/create_assessment.py | 82 +++++++++++++ .../snippets/create_site_key.py | 66 ++++++++++ .../snippets/delete_site_key.py | 57 +++++++++ recaptcha_enterprise/snippets/get_site_key.py | 57 +++++++++ .../snippets/list_site_keys.py | 56 +++++++++ .../snippets/noxfile_config.py | 38 ++++++ .../snippets/requirements-test.txt | 4 + .../snippets/requirements.txt | 1 + .../snippets/templates/index.html | 92 ++++++++++++++ .../snippets/test_create_assessment.py | 113 ++++++++++++++++++ .../snippets/test_site_key.py | 65 ++++++++++ .../snippets/update_site_key.py | 85 +++++++++++++ 12 files changed, 716 insertions(+) create mode 100644 recaptcha_enterprise/snippets/create_assessment.py create mode 100644 recaptcha_enterprise/snippets/create_site_key.py create mode 100644 recaptcha_enterprise/snippets/delete_site_key.py create mode 100644 recaptcha_enterprise/snippets/get_site_key.py create mode 100644 recaptcha_enterprise/snippets/list_site_keys.py create mode 100644 recaptcha_enterprise/snippets/noxfile_config.py create mode 100644 recaptcha_enterprise/snippets/requirements-test.txt create mode 100644 recaptcha_enterprise/snippets/requirements.txt create mode 100644 recaptcha_enterprise/snippets/templates/index.html create mode 100644 recaptcha_enterprise/snippets/test_create_assessment.py create mode 100644 recaptcha_enterprise/snippets/test_site_key.py create mode 100644 recaptcha_enterprise/snippets/update_site_key.py diff --git a/recaptcha_enterprise/snippets/create_assessment.py b/recaptcha_enterprise/snippets/create_assessment.py new file mode 100644 index 000000000000..ecda1e95479a --- /dev/null +++ b/recaptcha_enterprise/snippets/create_assessment.py @@ -0,0 +1,82 @@ +# Copyright 2021 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# [START recaptcha_enterprise_create_assessment] +from google.cloud import recaptchaenterprise_v1 + + +def create_assessment( + project_id: str, recaptcha_site_key: str, token: str, recaptcha_action: str +) -> None: + """ Create an assessment to analyze the risk of a UI action. + Args: + project_id: GCloud Project ID + recaptcha_site_key: Site key obtained by registering a domain/app to use recaptcha services. + token: The token obtained from the client on passing the recaptchaSiteKey. + recaptcha_action: Action name corresponding to the token. + """ + + # TODO(developer): Replace these variables before running the sample. + # Specify a name for this assessment. + assessment_name = "assessment_name" + + client = recaptchaenterprise_v1.RecaptchaEnterpriseServiceClient() + + # Set the properties of the event to be tracked. + event = recaptchaenterprise_v1.Event() + event.site_key = recaptcha_site_key + event.token = token + + assessment = recaptchaenterprise_v1.Assessment() + assessment.event = event + assessment.name = assessment_name + + project_name = f"projects/{project_id}" + + # Build the assessment request. + request = recaptchaenterprise_v1.CreateAssessmentRequest() + request.assessment = assessment + request.parent = project_name + + response = client.create_assessment(request) + + # Check if the token is valid. + if not response.token_properties.valid: + print( + "The CreateAssessment call failed because the token was " + + "invalid for for the following reasons: " + + str(response.token_properties.invalid_reason) + ) + return + + # Check if the expected action was executed. + if response.token_properties.action != recaptcha_action: + print( + "The action attribute in your reCAPTCHA tag does" + + "not match the action you are expecting to score" + ) + return + else: + # Get the risk score and the reason(s) + # For more information on interpreting the assessment, + # see: https://cloud.google.com/recaptcha-enterprise/docs/interpret-assessment + for reason in response.risk_analysis.reasons: + print(reason) + print( + "The reCAPTCHA score for this token is: " + + str(response.risk_analysis.score) + ) + + +# [END recaptcha_enterprise_create_assessment] diff --git a/recaptcha_enterprise/snippets/create_site_key.py b/recaptcha_enterprise/snippets/create_site_key.py new file mode 100644 index 000000000000..6e89343278ab --- /dev/null +++ b/recaptcha_enterprise/snippets/create_site_key.py @@ -0,0 +1,66 @@ +# Copyright 2021 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# [START recaptcha_enterprise_create_site_key] +from google.cloud import recaptchaenterprise_v1 + + +def create_site_key(project_id: str, domain_name: str) -> str: + """Create reCAPTCHA Site key which binds a domain name to a unique key. + Args: + project_id : GCloud Project ID. + domain_name: Specify the domain name in which the reCAPTCHA should be activated. + """ + client = recaptchaenterprise_v1.RecaptchaEnterpriseServiceClient() + + # Set the type of the reCAPTCHA to be displayed. + # For different types, see: https://cloud.google.com/recaptcha-enterprise/docs/keys + web_settings = recaptchaenterprise_v1.WebKeySettings() + web_settings.allowed_domains.append(domain_name) + web_settings.allow_amp_traffic = False + web_settings.integration_type = web_settings.IntegrationType.SCORE + + key = recaptchaenterprise_v1.Key() + key.display_name = "any descriptive name for the key" + key.web_settings = web_settings + + # Create the request. + request = recaptchaenterprise_v1.CreateKeyRequest() + request.parent = f"projects/{project_id}" + request.key = key + + # Get the name of the created reCAPTCHA site key. + response = client.create_key(request) + recaptcha_site_key = response.name.rsplit("/", maxsplit=1)[1] + print("reCAPTCHA Site key created successfully. Site Key: " + recaptcha_site_key) + return recaptcha_site_key + + +# [END recaptcha_enterprise_create_site_key] + +if __name__ == "__main__": + import google.auth + import google.auth.exceptions + + # TODO(developer): Replace the below variables before running + try: + default_project_id = google.auth.default()[1] + domain_name = "localhost" + except google.auth.exceptions.DefaultCredentialsError: + print( + "Please use `gcloud auth application-default login` " + "or set GOOGLE_APPLICATION_CREDENTIALS to use this script." + ) + else: + create_site_key(default_project_id, domain_name) diff --git a/recaptcha_enterprise/snippets/delete_site_key.py b/recaptcha_enterprise/snippets/delete_site_key.py new file mode 100644 index 000000000000..f9f9fb63582e --- /dev/null +++ b/recaptcha_enterprise/snippets/delete_site_key.py @@ -0,0 +1,57 @@ +# Copyright 2021 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# [START recaptcha_enterprise_delete_site_key] +from google.cloud import recaptchaenterprise_v1 + + +def delete_site_key(project_id: str, recaptcha_site_key: str) -> None: + """ Delete the given reCAPTCHA site key present under the project ID. + + Args: + project_id : GCloud Project ID. + recaptcha_site_key: Specify the key ID to be deleted. + """ + + client = recaptchaenterprise_v1.RecaptchaEnterpriseServiceClient() + + # Construct the key details. + key_name = f"projects/{project_id}/keys/{recaptcha_site_key}" + + # Set the project ID and reCAPTCHA site key. + request = recaptchaenterprise_v1.DeleteKeyRequest() + request.name = key_name + + client.delete_key(request) + print("reCAPTCHA Site key deleted successfully ! ") + + +# [END recaptcha_enterprise_delete_site_key] + + +if __name__ == "__main__": + import google.auth + import google.auth.exceptions + + # TODO(developer): Replace the below variables before running + try: + default_project_id = google.auth.default()[1] + recaptcha_site_key = "recaptcha_site_key" + except google.auth.exceptions.DefaultCredentialsError: + print( + "Please use `gcloud auth application-default login` " + "or set GOOGLE_APPLICATION_CREDENTIALS to use this script." + ) + else: + delete_site_key(default_project_id, recaptcha_site_key) diff --git a/recaptcha_enterprise/snippets/get_site_key.py b/recaptcha_enterprise/snippets/get_site_key.py new file mode 100644 index 000000000000..6d9eb8429939 --- /dev/null +++ b/recaptcha_enterprise/snippets/get_site_key.py @@ -0,0 +1,57 @@ +# Copyright 2021 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# [START recaptcha_enterprise_get_site_key] +from google.cloud import recaptchaenterprise_v1 + + +def get_site_key(project_id: str, recaptcha_site_key: str) -> None: + """ + Get the reCAPTCHA site key present under the project ID. + + Args: + project_id: GCloud Project ID. + recaptcha_site_key: Specify the site key to get the details. + """ + + client = recaptchaenterprise_v1.RecaptchaEnterpriseServiceClient() + + # Construct the key details. + key_name = f"projects/{project_id}/keys/{recaptcha_site_key}" + + request = recaptchaenterprise_v1.GetKeyRequest() + request.name = key_name + + key = client.get_key(request) + print("Successfully obtained the key !" + key.name) + + +# [END recaptcha_enterprise_get_site_key] + + +if __name__ == "__main__": + import google.auth + import google.auth.exceptions + + # TODO(developer): Replace the below variables before running + try: + default_project_id = google.auth.default()[1] + recaptcha_site_key = "recaptcha_site_key" + except google.auth.exceptions.DefaultCredentialsError: + print( + "Please use `gcloud auth application-default login` " + "or set GOOGLE_APPLICATION_CREDENTIALS to use this script." + ) + else: + get_site_key(default_project_id, recaptcha_site_key) diff --git a/recaptcha_enterprise/snippets/list_site_keys.py b/recaptcha_enterprise/snippets/list_site_keys.py new file mode 100644 index 000000000000..4510a9c0189f --- /dev/null +++ b/recaptcha_enterprise/snippets/list_site_keys.py @@ -0,0 +1,56 @@ +# Copyright 2021 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# [START recaptcha_enterprise_list_site_keys] +from google.cloud import recaptchaenterprise_v1 + + +def list_site_keys(project_id: str) -> None: + """ List all keys present under the given project ID. + + Args: + project_id: GCloud Project ID. + """ + + project_name = f"projects/{project_id}" + + client = recaptchaenterprise_v1.RecaptchaEnterpriseServiceClient() + + # Set the project id to list the keys present in it. + request = recaptchaenterprise_v1.ListKeysRequest() + request.parent = project_name + + response = client.list_keys(request) + print("Listing reCAPTCHA site keys: ") + for i, key in enumerate(response): + print(f"{str(i)}. {key.name}") + + +# [END recaptcha_enterprise_list_site_keys] + + +if __name__ == "__main__": + import google.auth + import google.auth.exceptions + + # TODO(developer): Replace the below variables before running + try: + default_project_id = google.auth.default()[1] + except google.auth.exceptions.DefaultCredentialsError: + print( + "Please use `gcloud auth application-default login` " + "or set GOOGLE_APPLICATION_CREDENTIALS to use this script." + ) + else: + list_site_keys(default_project_id) diff --git a/recaptcha_enterprise/snippets/noxfile_config.py b/recaptcha_enterprise/snippets/noxfile_config.py new file mode 100644 index 000000000000..cfbd02d7f9d8 --- /dev/null +++ b/recaptcha_enterprise/snippets/noxfile_config.py @@ -0,0 +1,38 @@ +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Default TEST_CONFIG_OVERRIDE for python repos. + +# You can copy this file into your directory, then it will be imported from +# the noxfile.py. + +# The source of truth: +# https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/noxfile_config.py + +TEST_CONFIG_OVERRIDE = { + # You can opt out from the test for specific Python versions. + "ignored_versions": ["2.7"], + # Old samples are opted out of enforcing Python type hints + # All new samples should feature them + "enforce_type_hints": True, + # An envvar key for determining the project id to use. Change it + # to 'BUILD_SPECIFIC_GCLOUD_PROJECT' if you want to opt in using a + # build specific Cloud project. You can also use your own string + # to use your own Cloud project. + # "gcloud_project_env": "GOOGLE_CLOUD_PROJECT", + "gcloud_project_env": "BUILD_SPECIFIC_GCLOUD_PROJECT", + # A dictionary you want to inject into your test. Don't put any + # secrets here. These values will override predefined values. + "envs": {}, +} diff --git a/recaptcha_enterprise/snippets/requirements-test.txt b/recaptcha_enterprise/snippets/requirements-test.txt new file mode 100644 index 000000000000..9e45473c7b6e --- /dev/null +++ b/recaptcha_enterprise/snippets/requirements-test.txt @@ -0,0 +1,4 @@ +selenium==3.141.0 +Flask==2.0.1 +pytest==6.2.4 +pytest-flask==1.2.0 \ No newline at end of file diff --git a/recaptcha_enterprise/snippets/requirements.txt b/recaptcha_enterprise/snippets/requirements.txt new file mode 100644 index 000000000000..3886b893aa26 --- /dev/null +++ b/recaptcha_enterprise/snippets/requirements.txt @@ -0,0 +1 @@ +google-cloud-recaptcha-enterprise==1.0.0 \ No newline at end of file diff --git a/recaptcha_enterprise/snippets/templates/index.html b/recaptcha_enterprise/snippets/templates/index.html new file mode 100644 index 000000000000..df77d5a43324 --- /dev/null +++ b/recaptcha_enterprise/snippets/templates/index.html @@ -0,0 +1,92 @@ + + + + + + + reCAPTCHA-Enterprise + + + + + +
+ + + + + + + +
+
+ +
+ + \ No newline at end of file diff --git a/recaptcha_enterprise/snippets/test_create_assessment.py b/recaptcha_enterprise/snippets/test_create_assessment.py new file mode 100644 index 000000000000..fc1cdac89aee --- /dev/null +++ b/recaptcha_enterprise/snippets/test_create_assessment.py @@ -0,0 +1,113 @@ +# Copyright 2021 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os +import re +import time +import typing + +from _pytest.capture import CaptureFixture +from flask import Flask, render_template, url_for +import pytest +from selenium import webdriver +from selenium.webdriver.chrome.webdriver import WebDriver + +import create_assessment + +# TODO(developer): Replace these variables before running the sample. +from create_site_key import create_site_key +from delete_site_key import delete_site_key + +GOOGLE_CLOUD_PROJECT = os.environ["GOOGLE_CLOUD_PROJECT"] +DOMAIN_NAME = "localhost" + + +@pytest.fixture(scope="session") +def app() -> Flask: + app = Flask(__name__) + + @app.route("/assess/", methods=["GET"]) + def assess(site_key: str) -> str: + return render_template("index.html", site_key=site_key) + + @app.route("/", methods=["GET"]) + def index() -> str: + return "Helloworld!" + + return app + + +@pytest.fixture(scope="module") +def browser() -> WebDriver: + chrome_options = webdriver.ChromeOptions() + chrome_options.add_argument('--no-sandbox') + chrome_options.add_argument('--window-size=1420,1080') + chrome_options.add_argument('--headless') + chrome_options.add_argument('--disable-gpu') + browser = webdriver.Chrome(chrome_options=chrome_options) + yield browser + browser.close() + + +@pytest.fixture(scope="module") +def recaptcha_site_key() -> str: + recaptcha_site_key = create_site_key( + project_id=GOOGLE_CLOUD_PROJECT, domain_name=DOMAIN_NAME + ) + yield recaptcha_site_key + delete_site_key( + project_id=GOOGLE_CLOUD_PROJECT, recaptcha_site_key=recaptcha_site_key + ) + + +@pytest.mark.usefixtures("live_server") +def test_create_assessment( + capsys: CaptureFixture, recaptcha_site_key: str, browser: WebDriver +) -> None: + token, action = get_token(recaptcha_site_key, browser) + assess_token(recaptcha_site_key, token=token, action=action) + out, _ = capsys.readouterr() + assert re.search("The reCAPTCHA score for this token is: ", out) + score = out.rsplit(":", maxsplit=1)[1].strip() + set_score(browser, score) + + +def get_token(recaptcha_site_key: str, browser: WebDriver) -> typing.Tuple: + browser.get(url_for("assess", site_key=recaptcha_site_key, _external=True)) + time.sleep(5) + + browser.find_element_by_id("username").send_keys("username") + browser.find_element_by_id("password").send_keys("password") + browser.find_element_by_id("recaptchabutton").click() + + # Timeout of 5 seconds + time.sleep(5) + + element = browser.find_element_by_css_selector("#assessment") + token = element.get_attribute("data-token") + action = element.get_attribute("data-action") + return token, action + + +def assess_token(recaptcha_site_key: str, token: str, action: str) -> None: + create_assessment.create_assessment( + project_id=GOOGLE_CLOUD_PROJECT, + recaptcha_site_key=recaptcha_site_key, + token=token, + recaptcha_action=action, + ) + + +def set_score(browser: WebDriver, score: str) -> None: + browser.find_element_by_css_selector("#assessment").send_keys(score) diff --git a/recaptcha_enterprise/snippets/test_site_key.py b/recaptcha_enterprise/snippets/test_site_key.py new file mode 100644 index 000000000000..1cc85c873d7b --- /dev/null +++ b/recaptcha_enterprise/snippets/test_site_key.py @@ -0,0 +1,65 @@ +# Copyright 2021 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import os +import re + +from _pytest.capture import CaptureFixture +import pytest + +from create_site_key import create_site_key +from delete_site_key import delete_site_key +from get_site_key import get_site_key +from list_site_keys import list_site_keys +from update_site_key import update_site_key + +# TODO(developer): Replace these variables before running the sample. +GOOGLE_CLOUD_PROJECT = os.environ["GOOGLE_CLOUD_PROJECT"] +DOMAIN_NAME = "localhost" + + +@pytest.fixture(scope="module") +def recaptcha_site_key() -> str: + recaptcha_site_key = create_site_key( + project_id=GOOGLE_CLOUD_PROJECT, domain_name=DOMAIN_NAME + ) + yield recaptcha_site_key + delete_site_key( + project_id=GOOGLE_CLOUD_PROJECT, recaptcha_site_key=recaptcha_site_key + ) + + +def test_create_site_key(recaptcha_site_key: str) -> None: + assert len(recaptcha_site_key) != 0 + + +def test_list_site_keys(capsys: CaptureFixture, recaptcha_site_key: str) -> None: + list_site_keys(project_id=GOOGLE_CLOUD_PROJECT) + out, _ = capsys.readouterr() + assert re.search(f"keys/{recaptcha_site_key}", out) + + +def test_get_site_key(capsys: CaptureFixture, recaptcha_site_key: str) -> None: + get_site_key(project_id=GOOGLE_CLOUD_PROJECT, recaptcha_site_key=recaptcha_site_key) + out, _ = capsys.readouterr() + assert re.search(f"Successfully obtained the key !.+{recaptcha_site_key}", out) + + +def test_update_site_key(capsys: CaptureFixture, recaptcha_site_key: str) -> None: + update_site_key( + project_id=GOOGLE_CLOUD_PROJECT, + recaptcha_site_key=recaptcha_site_key, + domain_name=DOMAIN_NAME + ) + out, _ = capsys.readouterr() + assert re.search("reCAPTCHA Site key successfully updated ! ", out) diff --git a/recaptcha_enterprise/snippets/update_site_key.py b/recaptcha_enterprise/snippets/update_site_key.py new file mode 100644 index 000000000000..8ee79a17a2f1 --- /dev/null +++ b/recaptcha_enterprise/snippets/update_site_key.py @@ -0,0 +1,85 @@ +# Copyright 2021 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# [START recaptcha_enterprise_update_site_key] +import time + +from google.cloud import recaptchaenterprise_v1 + + +def update_site_key(project_id: str, recaptcha_site_key: str, domain_name: str) -> None: + """ + Update the properties of the given site key present under the project id. + + Args: + project_id: GCloud Project ID. + recaptcha_site_key: Specify the site key. + domain_name: Specify the domain name for which the settings should be updated. + """ + + client = recaptchaenterprise_v1.RecaptchaEnterpriseServiceClient() + + # Construct the key details. + key_name = f"projects/{project_id}/keys/{recaptcha_site_key}" + + # Set the name and the new settings for the key. + web_settings = recaptchaenterprise_v1.WebKeySettings() + web_settings.allow_amp_traffic = True + web_settings.allowed_domains.append(domain_name) + + key = recaptchaenterprise_v1.Key() + key.display_name = "any descriptive name for the key" + key.name = key_name + key.web_settings = web_settings + + update_key_request = recaptchaenterprise_v1.UpdateKeyRequest() + update_key_request.key = key + client.update_key(update_key_request) + + time.sleep(5) + + # Retrieve the key and check if the property is updated. + get_key_request = recaptchaenterprise_v1.GetKeyRequest() + get_key_request.name = key_name + response = client.get_key(get_key_request) + web_settings = response.web_settings + + # Get the changed property. + if not web_settings.allow_amp_traffic: + print( + "Error! reCAPTCHA Site key property hasn't been updated. Please try again !" + ) + else: + print("reCAPTCHA Site key successfully updated ! ") + + +# [END recaptcha_enterprise_update_site_key] + + +if __name__ == "__main__": + import google.auth + import google.auth.exceptions + + # TODO(developer): Replace the below variables before running + try: + default_project_id = google.auth.default()[1] + recaptcha_site_key = "recaptcha_site_key" + domain_name = "localhost" + except google.auth.exceptions.DefaultCredentialsError: + print( + "Please use `gcloud auth application-default login` " + "or set GOOGLE_APPLICATION_CREDENTIALS to use this script." + ) + else: + update_site_key(default_project_id, recaptcha_site_key, domain_name) From f2bec72ea0e57ae9452f0f13e038a0009920e261 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Wed, 13 Oct 2021 17:16:30 +0200 Subject: [PATCH 02/63] chore(deps): update all dependencies (#136) * chore(deps): update all dependencies * fix: split selenium dependency on python 3.6 Co-authored-by: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> --- recaptcha_enterprise/snippets/requirements-test.txt | 9 +++++---- recaptcha_enterprise/snippets/requirements.txt | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/recaptcha_enterprise/snippets/requirements-test.txt b/recaptcha_enterprise/snippets/requirements-test.txt index 9e45473c7b6e..dec93b2e890d 100644 --- a/recaptcha_enterprise/snippets/requirements-test.txt +++ b/recaptcha_enterprise/snippets/requirements-test.txt @@ -1,4 +1,5 @@ -selenium==3.141.0 -Flask==2.0.1 -pytest==6.2.4 -pytest-flask==1.2.0 \ No newline at end of file +selenium==4.0.0; python_version > '3.6' +selenium==3.141.0; python_version <= '3.6' +Flask==2.0.2 +pytest==6.2.5 +pytest-flask==1.2.0 diff --git a/recaptcha_enterprise/snippets/requirements.txt b/recaptcha_enterprise/snippets/requirements.txt index 3886b893aa26..8d0191195f1d 100644 --- a/recaptcha_enterprise/snippets/requirements.txt +++ b/recaptcha_enterprise/snippets/requirements.txt @@ -1 +1 @@ -google-cloud-recaptcha-enterprise==1.0.0 \ No newline at end of file +google-cloud-recaptcha-enterprise==1.2.0 \ No newline at end of file From e9e38c9f2a5eadf393ace7b68547b56ca5ec99b7 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 25 Oct 2021 15:48:59 +0200 Subject: [PATCH 03/63] chore(deps): update dependency google-cloud-recaptcha-enterprise to v1.3.0 (#139) Co-authored-by: Anthonios Partheniou --- recaptcha_enterprise/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recaptcha_enterprise/snippets/requirements.txt b/recaptcha_enterprise/snippets/requirements.txt index 8d0191195f1d..e9d96b2b9a7e 100644 --- a/recaptcha_enterprise/snippets/requirements.txt +++ b/recaptcha_enterprise/snippets/requirements.txt @@ -1 +1 @@ -google-cloud-recaptcha-enterprise==1.2.0 \ No newline at end of file +google-cloud-recaptcha-enterprise==1.3.0 \ No newline at end of file From 13525e056d109b4e2b1a23154fda4ce1db8b92f4 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 2 Nov 2021 18:36:58 +0100 Subject: [PATCH 04/63] chore(deps): update dependency google-cloud-recaptcha-enterprise to v1.3.1 (#145) --- recaptcha_enterprise/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recaptcha_enterprise/snippets/requirements.txt b/recaptcha_enterprise/snippets/requirements.txt index e9d96b2b9a7e..d61eb8eb4898 100644 --- a/recaptcha_enterprise/snippets/requirements.txt +++ b/recaptcha_enterprise/snippets/requirements.txt @@ -1 +1 @@ -google-cloud-recaptcha-enterprise==1.3.0 \ No newline at end of file +google-cloud-recaptcha-enterprise==1.3.1 \ No newline at end of file From c6ab1e1dd3b534e306dc222bb1d3ad1129c2eb07 Mon Sep 17 00:00:00 2001 From: Sita Lakshmi Sangameswaran Date: Wed, 3 Nov 2021 16:48:04 +0530 Subject: [PATCH 05/63] docs(samples): removed assessment name in create_assessment sample (#147) --- recaptcha_enterprise/snippets/create_assessment.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/recaptcha_enterprise/snippets/create_assessment.py b/recaptcha_enterprise/snippets/create_assessment.py index ecda1e95479a..a7bb302a9dc5 100644 --- a/recaptcha_enterprise/snippets/create_assessment.py +++ b/recaptcha_enterprise/snippets/create_assessment.py @@ -27,10 +27,6 @@ def create_assessment( recaptcha_action: Action name corresponding to the token. """ - # TODO(developer): Replace these variables before running the sample. - # Specify a name for this assessment. - assessment_name = "assessment_name" - client = recaptchaenterprise_v1.RecaptchaEnterpriseServiceClient() # Set the properties of the event to be tracked. @@ -40,7 +36,6 @@ def create_assessment( assessment = recaptchaenterprise_v1.Assessment() assessment.event = event - assessment.name = assessment_name project_name = f"projects/{project_id}" From 56d156ac759762c3cc44830106a492414a7b6f81 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Thu, 4 Nov 2021 10:18:01 +0100 Subject: [PATCH 06/63] chore(deps): update dependency google-cloud-recaptcha-enterprise to v1.4.0 (#150) --- recaptcha_enterprise/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recaptcha_enterprise/snippets/requirements.txt b/recaptcha_enterprise/snippets/requirements.txt index d61eb8eb4898..8456e7c2a30a 100644 --- a/recaptcha_enterprise/snippets/requirements.txt +++ b/recaptcha_enterprise/snippets/requirements.txt @@ -1 +1 @@ -google-cloud-recaptcha-enterprise==1.3.1 \ No newline at end of file +google-cloud-recaptcha-enterprise==1.4.0 \ No newline at end of file From 07ed10023b4e4fcac9d0716a63f9854f911ecc0c Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Fri, 12 Nov 2021 11:46:58 -0500 Subject: [PATCH 07/63] chore: delete owlbot.py (#151) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: delete owlbot.py * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * use the latest post processor image * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- recaptcha_enterprise/snippets/test_create_assessment.py | 8 ++++---- recaptcha_enterprise/snippets/test_site_key.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/recaptcha_enterprise/snippets/test_create_assessment.py b/recaptcha_enterprise/snippets/test_create_assessment.py index fc1cdac89aee..c28e0a25163a 100644 --- a/recaptcha_enterprise/snippets/test_create_assessment.py +++ b/recaptcha_enterprise/snippets/test_create_assessment.py @@ -51,10 +51,10 @@ def index() -> str: @pytest.fixture(scope="module") def browser() -> WebDriver: chrome_options = webdriver.ChromeOptions() - chrome_options.add_argument('--no-sandbox') - chrome_options.add_argument('--window-size=1420,1080') - chrome_options.add_argument('--headless') - chrome_options.add_argument('--disable-gpu') + chrome_options.add_argument("--no-sandbox") + chrome_options.add_argument("--window-size=1420,1080") + chrome_options.add_argument("--headless") + chrome_options.add_argument("--disable-gpu") browser = webdriver.Chrome(chrome_options=chrome_options) yield browser browser.close() diff --git a/recaptcha_enterprise/snippets/test_site_key.py b/recaptcha_enterprise/snippets/test_site_key.py index 1cc85c873d7b..fb2f045431e0 100644 --- a/recaptcha_enterprise/snippets/test_site_key.py +++ b/recaptcha_enterprise/snippets/test_site_key.py @@ -59,7 +59,7 @@ def test_update_site_key(capsys: CaptureFixture, recaptcha_site_key: str) -> Non update_site_key( project_id=GOOGLE_CLOUD_PROJECT, recaptcha_site_key=recaptcha_site_key, - domain_name=DOMAIN_NAME + domain_name=DOMAIN_NAME, ) out, _ = capsys.readouterr() assert re.search("reCAPTCHA Site key successfully updated ! ", out) From d90d9df8d051372a04794248b7ecce50b3748bfa Mon Sep 17 00:00:00 2001 From: Sita Lakshmi Sangameswaran Date: Tue, 16 Nov 2021 22:36:17 +0530 Subject: [PATCH 08/63] docs(samples): added sample and tests for annotate assessment API (#155) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: - [ ] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/python-recaptcha-enterprise/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [ ] Ensure the tests and linter pass - [ ] Code coverage does not decrease (if any source code was changed) - [ ] Appropriate docs were updated (if necessary) Fixes #154 🦕 --- .../snippets/annotate_assessment.py | 43 +++++++++++++++++++ .../snippets/create_assessment.py | 8 +++- .../snippets/test_create_assessment.py | 39 ++++++++++++----- 3 files changed, 78 insertions(+), 12 deletions(-) create mode 100644 recaptcha_enterprise/snippets/annotate_assessment.py diff --git a/recaptcha_enterprise/snippets/annotate_assessment.py b/recaptcha_enterprise/snippets/annotate_assessment.py new file mode 100644 index 000000000000..7dca9251cbb4 --- /dev/null +++ b/recaptcha_enterprise/snippets/annotate_assessment.py @@ -0,0 +1,43 @@ +# Copyright 2021 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# [START recaptcha_enterprise_annotate_assessment] +from google.cloud import recaptchaenterprise_v1 + + +def annotate_assessment(project_id: str, assessment_id: str) -> None: + """ Pre-requisite: Create an assessment before annotating. + Annotate an assessment to provide feedback on the correctness of recaptcha prediction. + Args: + project_id: Google Cloud Project ID + assessment_id: Value of the 'name' field returned from the create_assessment() call. + """ + + client = recaptchaenterprise_v1.RecaptchaEnterpriseServiceClient() + + assessment_name = f"projects/{project_id}/assessments/{assessment_id}" + # Build the annotation request. + # For more info on when/how to annotate, see: + # https://cloud.google.com/recaptcha-enterprise/docs/annotate-assessment#when_to_annotate + request = recaptchaenterprise_v1.AnnotateAssessmentRequest() + request.name = assessment_name + request.annotation = request.Annotation.FRAUDULENT + request.reasons = [request.Reason.FAILED_TWO_FACTOR] + + # Empty response is sent back. + client.annotate_assessment(request) + print("Annotated response sent successfully ! ") + + +# [END recaptcha_enterprise_annotate_assessment] diff --git a/recaptcha_enterprise/snippets/create_assessment.py b/recaptcha_enterprise/snippets/create_assessment.py index a7bb302a9dc5..b1fe803c70b5 100644 --- a/recaptcha_enterprise/snippets/create_assessment.py +++ b/recaptcha_enterprise/snippets/create_assessment.py @@ -13,12 +13,14 @@ # limitations under the License. # [START recaptcha_enterprise_create_assessment] + from google.cloud import recaptchaenterprise_v1 +from google.cloud.recaptchaenterprise_v1 import Assessment def create_assessment( project_id: str, recaptcha_site_key: str, token: str, recaptcha_action: str -) -> None: +) -> Assessment: """ Create an assessment to analyze the risk of a UI action. Args: project_id: GCloud Project ID @@ -72,6 +74,10 @@ def create_assessment( "The reCAPTCHA score for this token is: " + str(response.risk_analysis.score) ) + # Get the assessment name (id). Use this to annotate the assessment. + assessment_name = client.parse_assessment_path(response.name).get("assessment") + print(f"Assessment name: {assessment_name}") + return response # [END recaptcha_enterprise_create_assessment] diff --git a/recaptcha_enterprise/snippets/test_create_assessment.py b/recaptcha_enterprise/snippets/test_create_assessment.py index c28e0a25163a..95de628bfa38 100644 --- a/recaptcha_enterprise/snippets/test_create_assessment.py +++ b/recaptcha_enterprise/snippets/test_create_assessment.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - +import multiprocessing import os import re import time @@ -19,18 +19,23 @@ from _pytest.capture import CaptureFixture from flask import Flask, render_template, url_for +from google.cloud import recaptchaenterprise_v1 +from google.cloud.recaptchaenterprise_v1 import Assessment import pytest + from selenium import webdriver from selenium.webdriver.chrome.webdriver import WebDriver -import create_assessment - -# TODO(developer): Replace these variables before running the sample. +from annotate_assessment import annotate_assessment +from create_assessment import create_assessment from create_site_key import create_site_key from delete_site_key import delete_site_key + GOOGLE_CLOUD_PROJECT = os.environ["GOOGLE_CLOUD_PROJECT"] DOMAIN_NAME = "localhost" +# Switch the multi-processing style for Python > 3.7: https://github.com/pytest-dev/pytest-flask/issues/104 +multiprocessing.set_start_method("fork") @pytest.fixture(scope="session") @@ -72,16 +77,28 @@ def recaptcha_site_key() -> str: @pytest.mark.usefixtures("live_server") -def test_create_assessment( +def test_assessment( capsys: CaptureFixture, recaptcha_site_key: str, browser: WebDriver ) -> None: + # Get token. token, action = get_token(recaptcha_site_key, browser) - assess_token(recaptcha_site_key, token=token, action=action) - out, _ = capsys.readouterr() - assert re.search("The reCAPTCHA score for this token is: ", out) - score = out.rsplit(":", maxsplit=1)[1].strip() + # Create assessment. + assessment_response = assess_token(recaptcha_site_key, token=token, action=action) + score = str(assessment_response.risk_analysis.score) + client = recaptchaenterprise_v1.RecaptchaEnterpriseServiceClient() + # Parse the assessment_response.name which is of the format: + # {'project': 'my-project-id', 'assessment': 'assessment-id'} + assessment_name = client.parse_assessment_path(assessment_response.name).get( + "assessment" + ) + assert assessment_name != "" set_score(browser, score) + # Annotate assessment. + annotate_assessment(project_id=GOOGLE_CLOUD_PROJECT, assessment_id=assessment_name) + out, _ = capsys.readouterr() + assert re.search("Annotated response sent successfully !", out) + def get_token(recaptcha_site_key: str, browser: WebDriver) -> typing.Tuple: browser.get(url_for("assess", site_key=recaptcha_site_key, _external=True)) @@ -100,8 +117,8 @@ def get_token(recaptcha_site_key: str, browser: WebDriver) -> typing.Tuple: return token, action -def assess_token(recaptcha_site_key: str, token: str, action: str) -> None: - create_assessment.create_assessment( +def assess_token(recaptcha_site_key: str, token: str, action: str) -> Assessment: + return create_assessment( project_id=GOOGLE_CLOUD_PROJECT, recaptcha_site_key=recaptcha_site_key, token=token, From 4045b5cb8b7b17c52fbd82adf85152b1e56243ac Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Thu, 18 Nov 2021 19:03:39 +0100 Subject: [PATCH 09/63] chore(deps): update dependency google-cloud-recaptcha-enterprise to v1.4.1 (#159) --- recaptcha_enterprise/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recaptcha_enterprise/snippets/requirements.txt b/recaptcha_enterprise/snippets/requirements.txt index 8456e7c2a30a..daa8b9ca6ba3 100644 --- a/recaptcha_enterprise/snippets/requirements.txt +++ b/recaptcha_enterprise/snippets/requirements.txt @@ -1 +1 @@ -google-cloud-recaptcha-enterprise==1.4.0 \ No newline at end of file +google-cloud-recaptcha-enterprise==1.4.1 \ No newline at end of file From e3055e147e7fe30c5b624784ad753c00a34c058b Mon Sep 17 00:00:00 2001 From: Sita Lakshmi Sangameswaran Date: Fri, 19 Nov 2021 17:48:15 +0530 Subject: [PATCH 10/63] docs(samples): added samples and test to migrate key and get metrics (#161) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: - [ ] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/python-recaptcha-enterprise/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [ ] Ensure the tests and linter pass - [ ] Code coverage does not decrease (if any source code was changed) - [ ] Appropriate docs were updated (if necessary) Fixes #160 🦕 --- recaptcha_enterprise/snippets/get_metrics.py | 47 +++++++++++++++++++ .../snippets/list_site_keys.py | 8 +++- .../snippets/migrate_site_key.py | 46 ++++++++++++++++++ .../snippets/test_site_key.py | 9 ++++ 4 files changed, 109 insertions(+), 1 deletion(-) create mode 100644 recaptcha_enterprise/snippets/get_metrics.py create mode 100644 recaptcha_enterprise/snippets/migrate_site_key.py diff --git a/recaptcha_enterprise/snippets/get_metrics.py b/recaptcha_enterprise/snippets/get_metrics.py new file mode 100644 index 000000000000..774ebf2c58e3 --- /dev/null +++ b/recaptcha_enterprise/snippets/get_metrics.py @@ -0,0 +1,47 @@ +# Copyright 2021 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# [START recaptcha_enterprise_get_metrics_site_key] +from google.cloud import recaptchaenterprise_v1 + + +def get_metrics(project_id: str, recaptcha_site_key: str) -> None: + """ Get metrics specific to a recaptcha site key. + E.g: score bucket count for a key or number of + times the checkbox key failed/ passed etc., + Args: + project_id: Google Cloud Project ID. + recaptcha_site_key: Specify the site key to get metrics. + """ + + client = recaptchaenterprise_v1.RecaptchaEnterpriseServiceClient() + + metrics_name = f"projects/{project_id}/keys/{recaptcha_site_key}/metrics" + request = recaptchaenterprise_v1.GetMetricsRequest() + request.name = metrics_name + + response = client.get_metrics(request) + + # Retrieve the metrics you want from the key. + # If the site key is checkbox type: then use response.challenge_metrics + # instead of response.score_metrics + for day_metric in response.score_metrics: + # Each 'day_metric' is in the granularity of one day. + score_bucket_count = day_metric.overall_metrics.score_buckets + print(score_bucket_count) + + print(f"Retrieved the bucket count for score based key: {recaptcha_site_key}") + + +# [END recaptcha_enterprise_get_metrics_site_key] diff --git a/recaptcha_enterprise/snippets/list_site_keys.py b/recaptcha_enterprise/snippets/list_site_keys.py index 4510a9c0189f..d460f88a02fa 100644 --- a/recaptcha_enterprise/snippets/list_site_keys.py +++ b/recaptcha_enterprise/snippets/list_site_keys.py @@ -15,8 +15,12 @@ # [START recaptcha_enterprise_list_site_keys] from google.cloud import recaptchaenterprise_v1 +from google.cloud.recaptchaenterprise_v1.services.recaptcha_enterprise_service.pagers import ( + ListKeysPager, +) -def list_site_keys(project_id: str) -> None: + +def list_site_keys(project_id: str) -> ListKeysPager: """ List all keys present under the given project ID. Args: @@ -36,6 +40,8 @@ def list_site_keys(project_id: str) -> None: for i, key in enumerate(response): print(f"{str(i)}. {key.name}") + return response + # [END recaptcha_enterprise_list_site_keys] diff --git a/recaptcha_enterprise/snippets/migrate_site_key.py b/recaptcha_enterprise/snippets/migrate_site_key.py new file mode 100644 index 000000000000..0c5187a841c9 --- /dev/null +++ b/recaptcha_enterprise/snippets/migrate_site_key.py @@ -0,0 +1,46 @@ +# Copyright 2021 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# [START recaptcha_enterprise_migrate_site_key] +from google.cloud import recaptchaenterprise_v1 + +from list_site_keys import list_site_keys + + +def migrate_site_key(project_id: str, recaptcha_site_key: str) -> None: + """ Migrate a key from reCAPTCHA (non-Enterprise) to reCAPTCHA Enterprise. + If you created the key using Admin console: https://www.google.com/recaptcha/admin/site, + then use this API to migrate to reCAPTCHA Enterprise. + For more info, see: https://cloud.google.com/recaptcha-enterprise/docs/migrate-recaptcha + Args: + project_id: Google Cloud Project ID. + recaptcha_site_key: Specify the site key to migrate. + """ + + client = recaptchaenterprise_v1.RecaptchaEnterpriseServiceClient() + + # Specify the key name to migrate. + name = f"projects/{project_id}/keys/{recaptcha_site_key}" + request = recaptchaenterprise_v1.MigrateKeyRequest() + request.name = name + + response = client.migrate_key(request) + # To verify if the site key has been migrated, use 'list_site_keys' to check if the + # key is present. + for key in list_site_keys(project_id): + if key.name == response.name: + print(f"Key migrated successfully: {recaptcha_site_key}") + + +# [END recaptcha_enterprise_migrate_site_key] diff --git a/recaptcha_enterprise/snippets/test_site_key.py b/recaptcha_enterprise/snippets/test_site_key.py index fb2f045431e0..e5bb45597454 100644 --- a/recaptcha_enterprise/snippets/test_site_key.py +++ b/recaptcha_enterprise/snippets/test_site_key.py @@ -19,6 +19,7 @@ from create_site_key import create_site_key from delete_site_key import delete_site_key +from get_metrics import get_metrics from get_site_key import get_site_key from list_site_keys import list_site_keys from update_site_key import update_site_key @@ -63,3 +64,11 @@ def test_update_site_key(capsys: CaptureFixture, recaptcha_site_key: str) -> Non ) out, _ = capsys.readouterr() assert re.search("reCAPTCHA Site key successfully updated ! ", out) + + +def test_get_metrics(capsys: CaptureFixture, recaptcha_site_key: str) -> None: + get_metrics(project_id=GOOGLE_CLOUD_PROJECT, recaptcha_site_key=recaptcha_site_key) + out, _ = capsys.readouterr() + assert re.search( + f"Retrieved the bucket count for score based key: {recaptcha_site_key}", out + ) From 2f7a4fcbeaa964ff1449d91983bc407e6a8ccc66 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Wed, 19 Jan 2022 02:51:31 +0100 Subject: [PATCH 11/63] chore(deps): update all dependencies (#177) * chore(deps): update all dependencies * revert pin change for python 3.6 Co-authored-by: Anthonios Partheniou --- recaptcha_enterprise/snippets/requirements-test.txt | 2 +- recaptcha_enterprise/snippets/requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/recaptcha_enterprise/snippets/requirements-test.txt b/recaptcha_enterprise/snippets/requirements-test.txt index dec93b2e890d..a855cd4c8e31 100644 --- a/recaptcha_enterprise/snippets/requirements-test.txt +++ b/recaptcha_enterprise/snippets/requirements-test.txt @@ -1,4 +1,4 @@ -selenium==4.0.0; python_version > '3.6' +selenium==4.1.0; python_version > '3.6' selenium==3.141.0; python_version <= '3.6' Flask==2.0.2 pytest==6.2.5 diff --git a/recaptcha_enterprise/snippets/requirements.txt b/recaptcha_enterprise/snippets/requirements.txt index daa8b9ca6ba3..ac23d282572e 100644 --- a/recaptcha_enterprise/snippets/requirements.txt +++ b/recaptcha_enterprise/snippets/requirements.txt @@ -1 +1 @@ -google-cloud-recaptcha-enterprise==1.4.1 \ No newline at end of file +google-cloud-recaptcha-enterprise==1.5.0 \ No newline at end of file From 43ff382fa9fd1fb057578175c230db4963febe5a Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Sat, 26 Feb 2022 19:57:32 +0100 Subject: [PATCH 12/63] chore(deps): update all dependencies (#186) * chore(deps): update all dependencies * chore: remove split pin on selenium We do not run tests on Python < 3.6. Co-authored-by: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> Co-authored-by: Anthonios Partheniou --- recaptcha_enterprise/snippets/requirements-test.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/recaptcha_enterprise/snippets/requirements-test.txt b/recaptcha_enterprise/snippets/requirements-test.txt index a855cd4c8e31..c9b469c32e60 100644 --- a/recaptcha_enterprise/snippets/requirements-test.txt +++ b/recaptcha_enterprise/snippets/requirements-test.txt @@ -1,5 +1,4 @@ -selenium==4.1.0; python_version > '3.6' -selenium==3.141.0; python_version <= '3.6' +selenium==4.1.0 Flask==2.0.2 -pytest==6.2.5 +pytest==7.0.1 pytest-flask==1.2.0 From 1b1d06194ff87012c0ea69111823a353003610e8 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 28 Feb 2022 23:39:04 +0100 Subject: [PATCH 13/63] chore(deps): update all dependencies (#190) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(deps): update all dependencies * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- recaptcha_enterprise/snippets/requirements-test.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recaptcha_enterprise/snippets/requirements-test.txt b/recaptcha_enterprise/snippets/requirements-test.txt index c9b469c32e60..ab8480033cd9 100644 --- a/recaptcha_enterprise/snippets/requirements-test.txt +++ b/recaptcha_enterprise/snippets/requirements-test.txt @@ -1,4 +1,4 @@ -selenium==4.1.0 -Flask==2.0.2 +selenium==4.1.2 +Flask==2.0.3 pytest==7.0.1 pytest-flask==1.2.0 From 474dd6729ab69b2a192f66a2790a94184b675683 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 1 Mar 2022 12:16:29 +0100 Subject: [PATCH 14/63] chore(deps): update all dependencies (#192) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(deps): update all dependencies * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- recaptcha_enterprise/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recaptcha_enterprise/snippets/requirements.txt b/recaptcha_enterprise/snippets/requirements.txt index ac23d282572e..8c04c6908d83 100644 --- a/recaptcha_enterprise/snippets/requirements.txt +++ b/recaptcha_enterprise/snippets/requirements.txt @@ -1 +1 @@ -google-cloud-recaptcha-enterprise==1.5.0 \ No newline at end of file +google-cloud-recaptcha-enterprise==1.6.0 \ No newline at end of file From 9ce8584b9d7b9f71defb1ab1fa37a068a367253c Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 7 Mar 2022 20:19:06 +0100 Subject: [PATCH 15/63] chore(deps): update dependency google-cloud-recaptcha-enterprise to v1.6.1 (#202) --- recaptcha_enterprise/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recaptcha_enterprise/snippets/requirements.txt b/recaptcha_enterprise/snippets/requirements.txt index 8c04c6908d83..8dfbf13796de 100644 --- a/recaptcha_enterprise/snippets/requirements.txt +++ b/recaptcha_enterprise/snippets/requirements.txt @@ -1 +1 @@ -google-cloud-recaptcha-enterprise==1.6.0 \ No newline at end of file +google-cloud-recaptcha-enterprise==1.6.1 \ No newline at end of file From 21e31466f65905f0b73b4f7ebb0fabc627133896 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Wed, 9 Mar 2022 18:54:07 +0100 Subject: [PATCH 16/63] chore(deps): update dependency selenium to v4.1.3 (#203) --- recaptcha_enterprise/snippets/requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recaptcha_enterprise/snippets/requirements-test.txt b/recaptcha_enterprise/snippets/requirements-test.txt index ab8480033cd9..b6763a8a9293 100644 --- a/recaptcha_enterprise/snippets/requirements-test.txt +++ b/recaptcha_enterprise/snippets/requirements-test.txt @@ -1,4 +1,4 @@ -selenium==4.1.2 +selenium==4.1.3 Flask==2.0.3 pytest==7.0.1 pytest-flask==1.2.0 From 43140049f8c179716bcf06669ff834699aff6c52 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Sun, 13 Mar 2022 17:03:38 +0100 Subject: [PATCH 17/63] chore(deps): update dependency pytest to v7.1.0 (#204) --- recaptcha_enterprise/snippets/requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recaptcha_enterprise/snippets/requirements-test.txt b/recaptcha_enterprise/snippets/requirements-test.txt index b6763a8a9293..858ca0874440 100644 --- a/recaptcha_enterprise/snippets/requirements-test.txt +++ b/recaptcha_enterprise/snippets/requirements-test.txt @@ -1,4 +1,4 @@ selenium==4.1.3 Flask==2.0.3 -pytest==7.0.1 +pytest==7.1.0 pytest-flask==1.2.0 From cd20532acd88d70487166539da59c4b90027f3ac Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Sat, 19 Mar 2022 11:19:26 +0100 Subject: [PATCH 18/63] chore(deps): update dependency pytest to v7.1.1 (#206) --- recaptcha_enterprise/snippets/requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recaptcha_enterprise/snippets/requirements-test.txt b/recaptcha_enterprise/snippets/requirements-test.txt index 858ca0874440..092220d3e359 100644 --- a/recaptcha_enterprise/snippets/requirements-test.txt +++ b/recaptcha_enterprise/snippets/requirements-test.txt @@ -1,4 +1,4 @@ selenium==4.1.3 Flask==2.0.3 -pytest==7.1.0 +pytest==7.1.1 pytest-flask==1.2.0 From 191c2c0276bc248189fb7fca1293a6c0b979d7a9 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 28 Mar 2022 23:54:31 +0000 Subject: [PATCH 19/63] chore(python): use black==22.3.0 (#209) Source-Link: https://github.com/googleapis/synthtool/commit/6fab84af09f2cf89a031fd8671d1def6b2931b11 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:7cffbc10910c3ab1b852c05114a08d374c195a81cdec1d4a67a1d129331d0bfe --- recaptcha_enterprise/snippets/annotate_assessment.py | 2 +- recaptcha_enterprise/snippets/create_assessment.py | 2 +- recaptcha_enterprise/snippets/delete_site_key.py | 2 +- recaptcha_enterprise/snippets/get_metrics.py | 2 +- recaptcha_enterprise/snippets/list_site_keys.py | 2 +- recaptcha_enterprise/snippets/migrate_site_key.py | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/recaptcha_enterprise/snippets/annotate_assessment.py b/recaptcha_enterprise/snippets/annotate_assessment.py index 7dca9251cbb4..3d215437935b 100644 --- a/recaptcha_enterprise/snippets/annotate_assessment.py +++ b/recaptcha_enterprise/snippets/annotate_assessment.py @@ -17,7 +17,7 @@ def annotate_assessment(project_id: str, assessment_id: str) -> None: - """ Pre-requisite: Create an assessment before annotating. + """Pre-requisite: Create an assessment before annotating. Annotate an assessment to provide feedback on the correctness of recaptcha prediction. Args: project_id: Google Cloud Project ID diff --git a/recaptcha_enterprise/snippets/create_assessment.py b/recaptcha_enterprise/snippets/create_assessment.py index b1fe803c70b5..efa6f4015e06 100644 --- a/recaptcha_enterprise/snippets/create_assessment.py +++ b/recaptcha_enterprise/snippets/create_assessment.py @@ -21,7 +21,7 @@ def create_assessment( project_id: str, recaptcha_site_key: str, token: str, recaptcha_action: str ) -> Assessment: - """ Create an assessment to analyze the risk of a UI action. + """Create an assessment to analyze the risk of a UI action. Args: project_id: GCloud Project ID recaptcha_site_key: Site key obtained by registering a domain/app to use recaptcha services. diff --git a/recaptcha_enterprise/snippets/delete_site_key.py b/recaptcha_enterprise/snippets/delete_site_key.py index f9f9fb63582e..9b13d41f38cf 100644 --- a/recaptcha_enterprise/snippets/delete_site_key.py +++ b/recaptcha_enterprise/snippets/delete_site_key.py @@ -17,7 +17,7 @@ def delete_site_key(project_id: str, recaptcha_site_key: str) -> None: - """ Delete the given reCAPTCHA site key present under the project ID. + """Delete the given reCAPTCHA site key present under the project ID. Args: project_id : GCloud Project ID. diff --git a/recaptcha_enterprise/snippets/get_metrics.py b/recaptcha_enterprise/snippets/get_metrics.py index 774ebf2c58e3..303128dd758d 100644 --- a/recaptcha_enterprise/snippets/get_metrics.py +++ b/recaptcha_enterprise/snippets/get_metrics.py @@ -17,7 +17,7 @@ def get_metrics(project_id: str, recaptcha_site_key: str) -> None: - """ Get metrics specific to a recaptcha site key. + """Get metrics specific to a recaptcha site key. E.g: score bucket count for a key or number of times the checkbox key failed/ passed etc., Args: diff --git a/recaptcha_enterprise/snippets/list_site_keys.py b/recaptcha_enterprise/snippets/list_site_keys.py index d460f88a02fa..6ac03e9b1c46 100644 --- a/recaptcha_enterprise/snippets/list_site_keys.py +++ b/recaptcha_enterprise/snippets/list_site_keys.py @@ -21,7 +21,7 @@ def list_site_keys(project_id: str) -> ListKeysPager: - """ List all keys present under the given project ID. + """List all keys present under the given project ID. Args: project_id: GCloud Project ID. diff --git a/recaptcha_enterprise/snippets/migrate_site_key.py b/recaptcha_enterprise/snippets/migrate_site_key.py index 0c5187a841c9..4d49fa11077d 100644 --- a/recaptcha_enterprise/snippets/migrate_site_key.py +++ b/recaptcha_enterprise/snippets/migrate_site_key.py @@ -19,7 +19,7 @@ def migrate_site_key(project_id: str, recaptcha_site_key: str) -> None: - """ Migrate a key from reCAPTCHA (non-Enterprise) to reCAPTCHA Enterprise. + """Migrate a key from reCAPTCHA (non-Enterprise) to reCAPTCHA Enterprise. If you created the key using Admin console: https://www.google.com/recaptcha/admin/site, then use this API to migrate to reCAPTCHA Enterprise. For more info, see: https://cloud.google.com/recaptcha-enterprise/docs/migrate-recaptcha From cbb798a0003e0fa0f6e6f7709581e2e8b22b5ac2 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Wed, 30 Mar 2022 16:09:07 +0200 Subject: [PATCH 20/63] chore(deps): update dependency flask to v2.1.0 (#208) --- recaptcha_enterprise/snippets/requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recaptcha_enterprise/snippets/requirements-test.txt b/recaptcha_enterprise/snippets/requirements-test.txt index 092220d3e359..c4558dca3c7e 100644 --- a/recaptcha_enterprise/snippets/requirements-test.txt +++ b/recaptcha_enterprise/snippets/requirements-test.txt @@ -1,4 +1,4 @@ selenium==4.1.3 -Flask==2.0.3 +Flask==2.1.0 pytest==7.1.1 pytest-flask==1.2.0 From 54a96f4f171e7fa0ba10503e687556f26481a152 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Fri, 1 Apr 2022 04:41:29 +0200 Subject: [PATCH 21/63] chore(deps): update dependency flask to v2.1.1 (#212) Co-authored-by: Anthonios Partheniou --- recaptcha_enterprise/snippets/requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recaptcha_enterprise/snippets/requirements-test.txt b/recaptcha_enterprise/snippets/requirements-test.txt index c4558dca3c7e..47a265365925 100644 --- a/recaptcha_enterprise/snippets/requirements-test.txt +++ b/recaptcha_enterprise/snippets/requirements-test.txt @@ -1,4 +1,4 @@ selenium==4.1.3 -Flask==2.1.0 +Flask==2.1.1 pytest==7.1.1 pytest-flask==1.2.0 From 4a2567f11f17d757b965fd4c121850424e41b01c Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 20 Apr 2022 20:27:13 -0400 Subject: [PATCH 22/63] chore(python): add nox session to sort python imports (#220) Source-Link: https://github.com/googleapis/synthtool/commit/1b71c10e20de7ed3f97f692f99a0e3399b67049f Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:00c9d764fd1cd56265f12a5ef4b99a0c9e87cf261018099141e2ca5158890416 Co-authored-by: Owl Bot --- recaptcha_enterprise/snippets/list_site_keys.py | 1 - recaptcha_enterprise/snippets/test_create_assessment.py | 2 -- 2 files changed, 3 deletions(-) diff --git a/recaptcha_enterprise/snippets/list_site_keys.py b/recaptcha_enterprise/snippets/list_site_keys.py index 6ac03e9b1c46..1c1f64e02a7a 100644 --- a/recaptcha_enterprise/snippets/list_site_keys.py +++ b/recaptcha_enterprise/snippets/list_site_keys.py @@ -14,7 +14,6 @@ # [START recaptcha_enterprise_list_site_keys] from google.cloud import recaptchaenterprise_v1 - from google.cloud.recaptchaenterprise_v1.services.recaptcha_enterprise_service.pagers import ( ListKeysPager, ) diff --git a/recaptcha_enterprise/snippets/test_create_assessment.py b/recaptcha_enterprise/snippets/test_create_assessment.py index 95de628bfa38..70293b3f79c1 100644 --- a/recaptcha_enterprise/snippets/test_create_assessment.py +++ b/recaptcha_enterprise/snippets/test_create_assessment.py @@ -22,7 +22,6 @@ from google.cloud import recaptchaenterprise_v1 from google.cloud.recaptchaenterprise_v1 import Assessment import pytest - from selenium import webdriver from selenium.webdriver.chrome.webdriver import WebDriver @@ -31,7 +30,6 @@ from create_site_key import create_site_key from delete_site_key import delete_site_key - GOOGLE_CLOUD_PROJECT = os.environ["GOOGLE_CLOUD_PROJECT"] DOMAIN_NAME = "localhost" # Switch the multi-processing style for Python > 3.7: https://github.com/pytest-dev/pytest-flask/issues/104 From 7ff04db1d8a29f53768b5c33feec85c8c6457063 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 25 Apr 2022 17:00:56 +0200 Subject: [PATCH 23/63] chore(deps): update dependency pytest to v7.1.2 (#223) --- recaptcha_enterprise/snippets/requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recaptcha_enterprise/snippets/requirements-test.txt b/recaptcha_enterprise/snippets/requirements-test.txt index 47a265365925..454a908e33b6 100644 --- a/recaptcha_enterprise/snippets/requirements-test.txt +++ b/recaptcha_enterprise/snippets/requirements-test.txt @@ -1,4 +1,4 @@ selenium==4.1.3 Flask==2.1.1 -pytest==7.1.1 +pytest==7.1.2 pytest-flask==1.2.0 From b381127f7e96008c2fa4680c4e3eb7fe2972d8ca Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Thu, 28 Apr 2022 23:45:51 +0200 Subject: [PATCH 24/63] chore(deps): update dependency flask to v2.1.2 (#225) --- recaptcha_enterprise/snippets/requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recaptcha_enterprise/snippets/requirements-test.txt b/recaptcha_enterprise/snippets/requirements-test.txt index 454a908e33b6..ce623d11ab1f 100644 --- a/recaptcha_enterprise/snippets/requirements-test.txt +++ b/recaptcha_enterprise/snippets/requirements-test.txt @@ -1,4 +1,4 @@ selenium==4.1.3 -Flask==2.1.1 +Flask==2.1.2 pytest==7.1.2 pytest-flask==1.2.0 From 22341118812c8973f075c14eb6cec9daa06acb13 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Thu, 5 May 2022 20:12:27 +0200 Subject: [PATCH 25/63] chore(deps): update dependency selenium to v4.1.5 (#231) --- recaptcha_enterprise/snippets/requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recaptcha_enterprise/snippets/requirements-test.txt b/recaptcha_enterprise/snippets/requirements-test.txt index ce623d11ab1f..fbf522c4b800 100644 --- a/recaptcha_enterprise/snippets/requirements-test.txt +++ b/recaptcha_enterprise/snippets/requirements-test.txt @@ -1,4 +1,4 @@ -selenium==4.1.3 +selenium==4.1.5 Flask==2.1.2 pytest==7.1.2 pytest-flask==1.2.0 From 65bb52c5590d69c7d605a90895b4329839a3dd51 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Thu, 19 May 2022 16:23:16 +0200 Subject: [PATCH 26/63] chore(deps): update dependency google-cloud-recaptcha-enterprise to v1.7.0 (#234) --- recaptcha_enterprise/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recaptcha_enterprise/snippets/requirements.txt b/recaptcha_enterprise/snippets/requirements.txt index 8dfbf13796de..5b4d074c1617 100644 --- a/recaptcha_enterprise/snippets/requirements.txt +++ b/recaptcha_enterprise/snippets/requirements.txt @@ -1 +1 @@ -google-cloud-recaptcha-enterprise==1.6.1 \ No newline at end of file +google-cloud-recaptcha-enterprise==1.7.0 \ No newline at end of file From f347c33ba3439aa6523da7e877e613e2be53241b Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Fri, 27 May 2022 19:59:05 +0200 Subject: [PATCH 27/63] chore(deps): update dependency selenium to v4.2.0 (#257) --- recaptcha_enterprise/snippets/requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recaptcha_enterprise/snippets/requirements-test.txt b/recaptcha_enterprise/snippets/requirements-test.txt index fbf522c4b800..bd22f05d3932 100644 --- a/recaptcha_enterprise/snippets/requirements-test.txt +++ b/recaptcha_enterprise/snippets/requirements-test.txt @@ -1,4 +1,4 @@ -selenium==4.1.5 +selenium==4.2.0 Flask==2.1.2 pytest==7.1.2 pytest-flask==1.2.0 From 48cb626841c3ef2871511e47cc2b958c7519a850 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Wed, 13 Jul 2022 19:59:44 +0200 Subject: [PATCH 28/63] chore(deps): update all dependencies (#263) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(deps): update all dependencies * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * revert Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- recaptcha_enterprise/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recaptcha_enterprise/snippets/requirements.txt b/recaptcha_enterprise/snippets/requirements.txt index 5b4d074c1617..efdd33604324 100644 --- a/recaptcha_enterprise/snippets/requirements.txt +++ b/recaptcha_enterprise/snippets/requirements.txt @@ -1 +1 @@ -google-cloud-recaptcha-enterprise==1.7.0 \ No newline at end of file +google-cloud-recaptcha-enterprise==1.7.1 \ No newline at end of file From 9329fb6eca52bc733617093e65034835a7dab669 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 2 Aug 2022 17:13:18 +0200 Subject: [PATCH 29/63] chore(deps): update all dependencies (#275) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(deps): update all dependencies * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * revert * test: find_element_by_id->find_element * test: add import from selenium.webdriver.common.by import By Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- recaptcha_enterprise/snippets/requirements-test.txt | 4 ++-- recaptcha_enterprise/snippets/requirements.txt | 2 +- .../snippets/test_create_assessment.py | 11 ++++++----- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/recaptcha_enterprise/snippets/requirements-test.txt b/recaptcha_enterprise/snippets/requirements-test.txt index bd22f05d3932..0ebdb19548a7 100644 --- a/recaptcha_enterprise/snippets/requirements-test.txt +++ b/recaptcha_enterprise/snippets/requirements-test.txt @@ -1,4 +1,4 @@ -selenium==4.2.0 -Flask==2.1.2 +selenium==4.3.0 +Flask==2.1.3 pytest==7.1.2 pytest-flask==1.2.0 diff --git a/recaptcha_enterprise/snippets/requirements.txt b/recaptcha_enterprise/snippets/requirements.txt index efdd33604324..7d4a79222755 100644 --- a/recaptcha_enterprise/snippets/requirements.txt +++ b/recaptcha_enterprise/snippets/requirements.txt @@ -1 +1 @@ -google-cloud-recaptcha-enterprise==1.7.1 \ No newline at end of file +google-cloud-recaptcha-enterprise==1.8.0 \ No newline at end of file diff --git a/recaptcha_enterprise/snippets/test_create_assessment.py b/recaptcha_enterprise/snippets/test_create_assessment.py index 70293b3f79c1..b1aa0f4e9d0a 100644 --- a/recaptcha_enterprise/snippets/test_create_assessment.py +++ b/recaptcha_enterprise/snippets/test_create_assessment.py @@ -24,6 +24,7 @@ import pytest from selenium import webdriver from selenium.webdriver.chrome.webdriver import WebDriver +from selenium.webdriver.common.by import By from annotate_assessment import annotate_assessment from create_assessment import create_assessment @@ -102,14 +103,14 @@ def get_token(recaptcha_site_key: str, browser: WebDriver) -> typing.Tuple: browser.get(url_for("assess", site_key=recaptcha_site_key, _external=True)) time.sleep(5) - browser.find_element_by_id("username").send_keys("username") - browser.find_element_by_id("password").send_keys("password") - browser.find_element_by_id("recaptchabutton").click() + browser.find_element(By.ID, "username").send_keys("username") + browser.find_element(By.ID, "password").send_keys("password") + browser.find_element(By.ID, "recaptchabutton").click() # Timeout of 5 seconds time.sleep(5) - element = browser.find_element_by_css_selector("#assessment") + element = browser.find_element(By.CSS_SELECTOR, "#assessment") token = element.get_attribute("data-token") action = element.get_attribute("data-action") return token, action @@ -125,4 +126,4 @@ def assess_token(recaptcha_site_key: str, token: str, action: str) -> Assessment def set_score(browser: WebDriver, score: str) -> None: - browser.find_element_by_css_selector("#assessment").send_keys(score) + browser.find_element(By.CSS_SELECTOR, "#assessment").send_keys(score) From e7ae86392ceff925e52ed60ceda7eb400eeca604 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Fri, 5 Aug 2022 21:59:46 +0200 Subject: [PATCH 30/63] chore(deps): update all dependencies (#276) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(deps): update all dependencies * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * revert Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- recaptcha_enterprise/snippets/requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recaptcha_enterprise/snippets/requirements-test.txt b/recaptcha_enterprise/snippets/requirements-test.txt index 0ebdb19548a7..53af17fad7a1 100644 --- a/recaptcha_enterprise/snippets/requirements-test.txt +++ b/recaptcha_enterprise/snippets/requirements-test.txt @@ -1,4 +1,4 @@ selenium==4.3.0 -Flask==2.1.3 +Flask==2.2.0 pytest==7.1.2 pytest-flask==1.2.0 From 7fe99128ca6220f08ec14cdf17a8086e3c2f2e1f Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Sat, 6 Aug 2022 02:25:22 +0200 Subject: [PATCH 31/63] chore(deps): update all dependencies (#277) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(deps): update all dependencies * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * revert Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- recaptcha_enterprise/snippets/requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recaptcha_enterprise/snippets/requirements-test.txt b/recaptcha_enterprise/snippets/requirements-test.txt index 53af17fad7a1..b55b517318c0 100644 --- a/recaptcha_enterprise/snippets/requirements-test.txt +++ b/recaptcha_enterprise/snippets/requirements-test.txt @@ -1,4 +1,4 @@ selenium==4.3.0 -Flask==2.2.0 +Flask==2.2.1 pytest==7.1.2 pytest-flask==1.2.0 From 7afbd612a3717ad1cd2c2f037819118053399497 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 9 Aug 2022 03:13:05 +0200 Subject: [PATCH 32/63] chore(deps): update all dependencies (#279) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(deps): update all dependencies * revert * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Anthonios Partheniou Co-authored-by: Owl Bot --- recaptcha_enterprise/snippets/requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recaptcha_enterprise/snippets/requirements-test.txt b/recaptcha_enterprise/snippets/requirements-test.txt index b55b517318c0..ca8920519281 100644 --- a/recaptcha_enterprise/snippets/requirements-test.txt +++ b/recaptcha_enterprise/snippets/requirements-test.txt @@ -1,4 +1,4 @@ selenium==4.3.0 -Flask==2.2.1 +Flask==2.2.2 pytest==7.1.2 pytest-flask==1.2.0 From 30ac9ba144890b0afa7531a1dd5dac6caeb561f7 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 9 Aug 2022 13:41:27 +0200 Subject: [PATCH 33/63] chore(deps): update all dependencies (#280) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(deps): update all dependencies * revert * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Anthonios Partheniou Co-authored-by: Owl Bot --- recaptcha_enterprise/snippets/requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recaptcha_enterprise/snippets/requirements-test.txt b/recaptcha_enterprise/snippets/requirements-test.txt index ca8920519281..37d0a0608cae 100644 --- a/recaptcha_enterprise/snippets/requirements-test.txt +++ b/recaptcha_enterprise/snippets/requirements-test.txt @@ -1,4 +1,4 @@ -selenium==4.3.0 +selenium==4.4.0 Flask==2.2.2 pytest==7.1.2 pytest-flask==1.2.0 From 8e2cf2760524356f4e66a4b402a42b60a585253a Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 15 Aug 2022 17:01:36 +0200 Subject: [PATCH 34/63] chore(deps): update dependency google-cloud-recaptcha-enterprise to v1.8.1 (#285) --- recaptcha_enterprise/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recaptcha_enterprise/snippets/requirements.txt b/recaptcha_enterprise/snippets/requirements.txt index 7d4a79222755..9f3da8584aad 100644 --- a/recaptcha_enterprise/snippets/requirements.txt +++ b/recaptcha_enterprise/snippets/requirements.txt @@ -1 +1 @@ -google-cloud-recaptcha-enterprise==1.8.0 \ No newline at end of file +google-cloud-recaptcha-enterprise==1.8.1 \ No newline at end of file From 21bba1be00064cce0b5756079fd0312f21dc2966 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 23 Aug 2022 16:23:56 +0200 Subject: [PATCH 35/63] chore(deps): update dependency selenium to v4.4.3 (#286) --- recaptcha_enterprise/snippets/requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recaptcha_enterprise/snippets/requirements-test.txt b/recaptcha_enterprise/snippets/requirements-test.txt index 37d0a0608cae..cda1fe72561c 100644 --- a/recaptcha_enterprise/snippets/requirements-test.txt +++ b/recaptcha_enterprise/snippets/requirements-test.txt @@ -1,4 +1,4 @@ -selenium==4.4.0 +selenium==4.4.3 Flask==2.2.2 pytest==7.1.2 pytest-flask==1.2.0 From a1c246c74e182da8be80317513800b7486edc8cf Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 6 Sep 2022 17:20:10 +0200 Subject: [PATCH 36/63] chore(deps): update dependency pytest to v7.1.3 (#297) --- recaptcha_enterprise/snippets/requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recaptcha_enterprise/snippets/requirements-test.txt b/recaptcha_enterprise/snippets/requirements-test.txt index cda1fe72561c..c51f80b01af0 100644 --- a/recaptcha_enterprise/snippets/requirements-test.txt +++ b/recaptcha_enterprise/snippets/requirements-test.txt @@ -1,4 +1,4 @@ selenium==4.4.3 Flask==2.2.2 -pytest==7.1.2 +pytest==7.1.3 pytest-flask==1.2.0 From b33f8445100bc0bebed504857dd2638e759543e2 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 3 Oct 2022 19:07:54 +0200 Subject: [PATCH 37/63] chore(deps): update dependency selenium to v4.5.0 (#305) Co-authored-by: Anthonios Partheniou --- recaptcha_enterprise/snippets/requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recaptcha_enterprise/snippets/requirements-test.txt b/recaptcha_enterprise/snippets/requirements-test.txt index c51f80b01af0..9e24dcbb552e 100644 --- a/recaptcha_enterprise/snippets/requirements-test.txt +++ b/recaptcha_enterprise/snippets/requirements-test.txt @@ -1,4 +1,4 @@ -selenium==4.4.3 +selenium==4.5.0 Flask==2.2.2 pytest==7.1.3 pytest-flask==1.2.0 From 7074f7054dc265e14f3c3b4121ad819234e6c5f9 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 4 Oct 2022 15:31:06 +0200 Subject: [PATCH 38/63] chore(deps): update dependency google-cloud-recaptcha-enterprise to v1.8.2 (#307) --- recaptcha_enterprise/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recaptcha_enterprise/snippets/requirements.txt b/recaptcha_enterprise/snippets/requirements.txt index 9f3da8584aad..e9ba2c8e7391 100644 --- a/recaptcha_enterprise/snippets/requirements.txt +++ b/recaptcha_enterprise/snippets/requirements.txt @@ -1 +1 @@ -google-cloud-recaptcha-enterprise==1.8.1 \ No newline at end of file +google-cloud-recaptcha-enterprise==1.8.2 \ No newline at end of file From 557925993d2e5b01930cfd9edb6596df1a63909b Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 10 Oct 2022 20:13:16 +0200 Subject: [PATCH 39/63] chore(deps): update dependency google-cloud-recaptcha-enterprise to v1.8.3 (#310) --- recaptcha_enterprise/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recaptcha_enterprise/snippets/requirements.txt b/recaptcha_enterprise/snippets/requirements.txt index e9ba2c8e7391..f142e8eb87fa 100644 --- a/recaptcha_enterprise/snippets/requirements.txt +++ b/recaptcha_enterprise/snippets/requirements.txt @@ -1 +1 @@ -google-cloud-recaptcha-enterprise==1.8.2 \ No newline at end of file +google-cloud-recaptcha-enterprise==1.8.3 \ No newline at end of file From 09f7c8528b38da7a080ec07092803be730dc3152 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Wed, 26 Oct 2022 12:46:09 +0200 Subject: [PATCH 40/63] chore(deps): update dependency pytest to v7.2.0 (#313) --- recaptcha_enterprise/snippets/requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recaptcha_enterprise/snippets/requirements-test.txt b/recaptcha_enterprise/snippets/requirements-test.txt index 9e24dcbb552e..8a01b9e333ef 100644 --- a/recaptcha_enterprise/snippets/requirements-test.txt +++ b/recaptcha_enterprise/snippets/requirements-test.txt @@ -1,4 +1,4 @@ selenium==4.5.0 Flask==2.2.2 -pytest==7.1.3 +pytest==7.2.0 pytest-flask==1.2.0 From 42baf14468218c59395fe7c3f24664626a3e3357 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Fri, 28 Oct 2022 14:22:23 +0200 Subject: [PATCH 41/63] chore(deps): update dependency google-cloud-recaptcha-enterprise to v1.9.0 (#314) --- recaptcha_enterprise/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recaptcha_enterprise/snippets/requirements.txt b/recaptcha_enterprise/snippets/requirements.txt index f142e8eb87fa..ed1f9045ed45 100644 --- a/recaptcha_enterprise/snippets/requirements.txt +++ b/recaptcha_enterprise/snippets/requirements.txt @@ -1 +1 @@ -google-cloud-recaptcha-enterprise==1.8.3 \ No newline at end of file +google-cloud-recaptcha-enterprise==1.9.0 \ No newline at end of file From 79ea7a5cd5d56b53ba93f2de3c30d03aee0fcfdd Mon Sep 17 00:00:00 2001 From: Sampath M Date: Fri, 18 Nov 2022 14:45:36 +0100 Subject: [PATCH 42/63] Update copyright header --- recaptcha_enterprise/snippets/annotate_assessment.py | 5 ++++- recaptcha_enterprise/snippets/create_assessment.py | 5 ++++- recaptcha_enterprise/snippets/create_site_key.py | 5 ++++- recaptcha_enterprise/snippets/delete_site_key.py | 5 ++++- recaptcha_enterprise/snippets/get_metrics.py | 5 ++++- recaptcha_enterprise/snippets/get_site_key.py | 5 ++++- recaptcha_enterprise/snippets/list_site_keys.py | 5 ++++- recaptcha_enterprise/snippets/migrate_site_key.py | 5 ++++- recaptcha_enterprise/snippets/test_site_key.py | 7 ++++++- recaptcha_enterprise/snippets/update_site_key.py | 5 ++++- 10 files changed, 42 insertions(+), 10 deletions(-) diff --git a/recaptcha_enterprise/snippets/annotate_assessment.py b/recaptcha_enterprise/snippets/annotate_assessment.py index 3d215437935b..b4bbf4c336bf 100644 --- a/recaptcha_enterprise/snippets/annotate_assessment.py +++ b/recaptcha_enterprise/snippets/annotate_assessment.py @@ -1,4 +1,5 @@ -# Copyright 2021 Google Inc. All Rights Reserved. +#!/usr/bin/env python +# Copyright 2021 Google Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -11,6 +12,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# +# All Rights Reserved. # [START recaptcha_enterprise_annotate_assessment] from google.cloud import recaptchaenterprise_v1 diff --git a/recaptcha_enterprise/snippets/create_assessment.py b/recaptcha_enterprise/snippets/create_assessment.py index efa6f4015e06..a14f1524a37d 100644 --- a/recaptcha_enterprise/snippets/create_assessment.py +++ b/recaptcha_enterprise/snippets/create_assessment.py @@ -1,4 +1,5 @@ -# Copyright 2021 Google Inc. All Rights Reserved. +#!/usr/bin/env python +# Copyright 2021 Google Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -11,6 +12,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# +# All Rights Reserved. # [START recaptcha_enterprise_create_assessment] diff --git a/recaptcha_enterprise/snippets/create_site_key.py b/recaptcha_enterprise/snippets/create_site_key.py index 6e89343278ab..0b44b938f5d5 100644 --- a/recaptcha_enterprise/snippets/create_site_key.py +++ b/recaptcha_enterprise/snippets/create_site_key.py @@ -1,4 +1,5 @@ -# Copyright 2021 Google Inc. All Rights Reserved. +#!/usr/bin/env python +# Copyright 2021 Google Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -11,6 +12,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# +# All Rights Reserved. # [START recaptcha_enterprise_create_site_key] from google.cloud import recaptchaenterprise_v1 diff --git a/recaptcha_enterprise/snippets/delete_site_key.py b/recaptcha_enterprise/snippets/delete_site_key.py index 9b13d41f38cf..50cb0fcf2228 100644 --- a/recaptcha_enterprise/snippets/delete_site_key.py +++ b/recaptcha_enterprise/snippets/delete_site_key.py @@ -1,4 +1,5 @@ -# Copyright 2021 Google Inc. All Rights Reserved. +#!/usr/bin/env python +# Copyright 2021 Google Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -11,6 +12,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# +# All Rights Reserved. # [START recaptcha_enterprise_delete_site_key] from google.cloud import recaptchaenterprise_v1 diff --git a/recaptcha_enterprise/snippets/get_metrics.py b/recaptcha_enterprise/snippets/get_metrics.py index 303128dd758d..4ab0a6dd413e 100644 --- a/recaptcha_enterprise/snippets/get_metrics.py +++ b/recaptcha_enterprise/snippets/get_metrics.py @@ -1,4 +1,5 @@ -# Copyright 2021 Google Inc. All Rights Reserved. +#!/usr/bin/env python +# Copyright 2021 Google Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -11,6 +12,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# +# All Rights Reserved. # [START recaptcha_enterprise_get_metrics_site_key] from google.cloud import recaptchaenterprise_v1 diff --git a/recaptcha_enterprise/snippets/get_site_key.py b/recaptcha_enterprise/snippets/get_site_key.py index 6d9eb8429939..bbf2b7013204 100644 --- a/recaptcha_enterprise/snippets/get_site_key.py +++ b/recaptcha_enterprise/snippets/get_site_key.py @@ -1,4 +1,5 @@ -# Copyright 2021 Google Inc. All Rights Reserved. +#!/usr/bin/env python +# Copyright 2021 Google Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -11,6 +12,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# +# All Rights Reserved. # [START recaptcha_enterprise_get_site_key] from google.cloud import recaptchaenterprise_v1 diff --git a/recaptcha_enterprise/snippets/list_site_keys.py b/recaptcha_enterprise/snippets/list_site_keys.py index 1c1f64e02a7a..0e08446a9817 100644 --- a/recaptcha_enterprise/snippets/list_site_keys.py +++ b/recaptcha_enterprise/snippets/list_site_keys.py @@ -1,4 +1,5 @@ -# Copyright 2021 Google Inc. All Rights Reserved. +#!/usr/bin/env python +# Copyright 2021 Google Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -11,6 +12,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# +# All Rights Reserved. # [START recaptcha_enterprise_list_site_keys] from google.cloud import recaptchaenterprise_v1 diff --git a/recaptcha_enterprise/snippets/migrate_site_key.py b/recaptcha_enterprise/snippets/migrate_site_key.py index 4d49fa11077d..638abfe3d53a 100644 --- a/recaptcha_enterprise/snippets/migrate_site_key.py +++ b/recaptcha_enterprise/snippets/migrate_site_key.py @@ -1,4 +1,5 @@ -# Copyright 2021 Google Inc. All Rights Reserved. +#!/usr/bin/env python +# Copyright 2021 Google Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -11,6 +12,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# +# All Rights Reserved. # [START recaptcha_enterprise_migrate_site_key] from google.cloud import recaptchaenterprise_v1 diff --git a/recaptcha_enterprise/snippets/test_site_key.py b/recaptcha_enterprise/snippets/test_site_key.py index e5bb45597454..bc137994f05b 100644 --- a/recaptcha_enterprise/snippets/test_site_key.py +++ b/recaptcha_enterprise/snippets/test_site_key.py @@ -1,4 +1,5 @@ -# Copyright 2021 Google Inc. All Rights Reserved. +#!/usr/bin/env python +# Copyright 2021 Google Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -11,6 +12,10 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# +# All Rights Reserved. + + import os import re diff --git a/recaptcha_enterprise/snippets/update_site_key.py b/recaptcha_enterprise/snippets/update_site_key.py index 8ee79a17a2f1..a7a05ecbcade 100644 --- a/recaptcha_enterprise/snippets/update_site_key.py +++ b/recaptcha_enterprise/snippets/update_site_key.py @@ -1,4 +1,5 @@ -# Copyright 2021 Google Inc. All Rights Reserved. +#!/usr/bin/env python +# Copyright 2021 Google Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -11,6 +12,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# +# All Rights Reserved. # [START recaptcha_enterprise_update_site_key] import time From 608bc03eb0ce31f35b823a3916e31b8a292cf49a Mon Sep 17 00:00:00 2001 From: Sampath M Date: Fri, 18 Nov 2022 14:46:08 +0100 Subject: [PATCH 43/63] Fix: selenium web-driver path issue --- recaptcha_enterprise/snippets/requirements-test.txt | 1 + .../snippets/test_create_assessment.py | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/recaptcha_enterprise/snippets/requirements-test.txt b/recaptcha_enterprise/snippets/requirements-test.txt index 8a01b9e333ef..be782c6435b2 100644 --- a/recaptcha_enterprise/snippets/requirements-test.txt +++ b/recaptcha_enterprise/snippets/requirements-test.txt @@ -2,3 +2,4 @@ selenium==4.5.0 Flask==2.2.2 pytest==7.2.0 pytest-flask==1.2.0 +webdriver-manager==3.8.5 \ No newline at end of file diff --git a/recaptcha_enterprise/snippets/test_create_assessment.py b/recaptcha_enterprise/snippets/test_create_assessment.py index b1aa0f4e9d0a..f3099ce1665d 100644 --- a/recaptcha_enterprise/snippets/test_create_assessment.py +++ b/recaptcha_enterprise/snippets/test_create_assessment.py @@ -1,4 +1,5 @@ -# Copyright 2021 Google Inc. All Rights Reserved. +#!/usr/bin/env python +# Copyright 2021 Google Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -11,6 +12,9 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# +# All Rights Reserved. + import multiprocessing import os import re @@ -21,8 +25,11 @@ from flask import Flask, render_template, url_for from google.cloud import recaptchaenterprise_v1 from google.cloud.recaptchaenterprise_v1 import Assessment + import pytest + from selenium import webdriver +from webdriver_manager.chrome import ChromeDriverManager from selenium.webdriver.chrome.webdriver import WebDriver from selenium.webdriver.common.by import By @@ -59,7 +66,8 @@ def browser() -> WebDriver: chrome_options.add_argument("--window-size=1420,1080") chrome_options.add_argument("--headless") chrome_options.add_argument("--disable-gpu") - browser = webdriver.Chrome(chrome_options=chrome_options) + browser = webdriver.Chrome(ChromeDriverManager().install(), + chrome_options=chrome_options) yield browser browser.close() From 77779ca20784e9d9fcb88da6db2fd232671c23db Mon Sep 17 00:00:00 2001 From: Sampath M Date: Fri, 18 Nov 2022 14:46:39 +0100 Subject: [PATCH 44/63] Update CODEOWNERS and blunderbuss.yml --- .github/CODEOWNERS | 3 ++- .github/blunderbuss.yml | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 0458dce6e0af..21822e1e030a 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -78,4 +78,5 @@ /workflows/**/* @GoogleCloudPlatform/python-samples-reviewers /datacatalog/**/* @GoogleCloudPlatform/python-samples-reviewers /kms/**/** @GoogleCloudPlatform/dee-infra @GoogleCloudPlatform/python-samples-reviewers -/dataproc/**/** @GoogleCloudPlatform/cloud-dpes @GoogleCloudPlatform/python-samples-reviewers \ No newline at end of file +/dataproc/**/** @GoogleCloudPlatform/cloud-dpes @GoogleCloudPlatform/python-samples-reviewers +recaptcha_enterprise/**/* @sitalakshmi @GoogleCloudPlatform/python-samples-reviewers \ No newline at end of file diff --git a/.github/blunderbuss.yml b/.github/blunderbuss.yml index 1689daa99926..d564b0017f67 100644 --- a/.github/blunderbuss.yml +++ b/.github/blunderbuss.yml @@ -184,6 +184,10 @@ assign_prs_by: - 'api: dataproc' to: - GoogleCloudPlatform/cloud-dpes +- labels: + - 'api: recaptchaenterprise' + to: + - GoogleCloudPlatform//python-samples-reviewers assign_issues: - GoogleCloudPlatform/python-samples-owners From 7235b42b0d4922b80a037ec49f283ac25d932d87 Mon Sep 17 00:00:00 2001 From: Sampath M Date: Fri, 18 Nov 2022 14:51:40 +0100 Subject: [PATCH 45/63] Update copyright headers change "Google Inc" to "Google, Inc" --- recaptcha_enterprise/snippets/annotate_assessment.py | 2 +- recaptcha_enterprise/snippets/create_assessment.py | 2 +- recaptcha_enterprise/snippets/create_site_key.py | 2 +- recaptcha_enterprise/snippets/delete_site_key.py | 2 +- recaptcha_enterprise/snippets/get_metrics.py | 2 +- recaptcha_enterprise/snippets/get_site_key.py | 2 +- recaptcha_enterprise/snippets/list_site_keys.py | 2 +- recaptcha_enterprise/snippets/migrate_site_key.py | 2 +- recaptcha_enterprise/snippets/test_create_assessment.py | 2 +- recaptcha_enterprise/snippets/test_site_key.py | 2 +- recaptcha_enterprise/snippets/update_site_key.py | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/recaptcha_enterprise/snippets/annotate_assessment.py b/recaptcha_enterprise/snippets/annotate_assessment.py index b4bbf4c336bf..7760d636cbc4 100644 --- a/recaptcha_enterprise/snippets/annotate_assessment.py +++ b/recaptcha_enterprise/snippets/annotate_assessment.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright 2021 Google Inc +# Copyright 2021 Google, Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/recaptcha_enterprise/snippets/create_assessment.py b/recaptcha_enterprise/snippets/create_assessment.py index a14f1524a37d..14adf019c799 100644 --- a/recaptcha_enterprise/snippets/create_assessment.py +++ b/recaptcha_enterprise/snippets/create_assessment.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright 2021 Google Inc +# Copyright 2021 Google, Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/recaptcha_enterprise/snippets/create_site_key.py b/recaptcha_enterprise/snippets/create_site_key.py index 0b44b938f5d5..faf9bbbe2517 100644 --- a/recaptcha_enterprise/snippets/create_site_key.py +++ b/recaptcha_enterprise/snippets/create_site_key.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright 2021 Google Inc +# Copyright 2021 Google, Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/recaptcha_enterprise/snippets/delete_site_key.py b/recaptcha_enterprise/snippets/delete_site_key.py index 50cb0fcf2228..4dbd039f960a 100644 --- a/recaptcha_enterprise/snippets/delete_site_key.py +++ b/recaptcha_enterprise/snippets/delete_site_key.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright 2021 Google Inc +# Copyright 2021 Google, Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/recaptcha_enterprise/snippets/get_metrics.py b/recaptcha_enterprise/snippets/get_metrics.py index 4ab0a6dd413e..8238329d9c9a 100644 --- a/recaptcha_enterprise/snippets/get_metrics.py +++ b/recaptcha_enterprise/snippets/get_metrics.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright 2021 Google Inc +# Copyright 2021 Google, Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/recaptcha_enterprise/snippets/get_site_key.py b/recaptcha_enterprise/snippets/get_site_key.py index bbf2b7013204..c27fba5e2819 100644 --- a/recaptcha_enterprise/snippets/get_site_key.py +++ b/recaptcha_enterprise/snippets/get_site_key.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright 2021 Google Inc +# Copyright 2021 Google, Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/recaptcha_enterprise/snippets/list_site_keys.py b/recaptcha_enterprise/snippets/list_site_keys.py index 0e08446a9817..c865184dfa06 100644 --- a/recaptcha_enterprise/snippets/list_site_keys.py +++ b/recaptcha_enterprise/snippets/list_site_keys.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright 2021 Google Inc +# Copyright 2021 Google, Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/recaptcha_enterprise/snippets/migrate_site_key.py b/recaptcha_enterprise/snippets/migrate_site_key.py index 638abfe3d53a..1b4b799e746c 100644 --- a/recaptcha_enterprise/snippets/migrate_site_key.py +++ b/recaptcha_enterprise/snippets/migrate_site_key.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright 2021 Google Inc +# Copyright 2021 Google, Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/recaptcha_enterprise/snippets/test_create_assessment.py b/recaptcha_enterprise/snippets/test_create_assessment.py index f3099ce1665d..cd9d7809b5e4 100644 --- a/recaptcha_enterprise/snippets/test_create_assessment.py +++ b/recaptcha_enterprise/snippets/test_create_assessment.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright 2021 Google Inc +# Copyright 2021 Google, Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/recaptcha_enterprise/snippets/test_site_key.py b/recaptcha_enterprise/snippets/test_site_key.py index bc137994f05b..62b73b41786d 100644 --- a/recaptcha_enterprise/snippets/test_site_key.py +++ b/recaptcha_enterprise/snippets/test_site_key.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright 2021 Google Inc +# Copyright 2021 Google, Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/recaptcha_enterprise/snippets/update_site_key.py b/recaptcha_enterprise/snippets/update_site_key.py index a7a05ecbcade..af4533ad969f 100644 --- a/recaptcha_enterprise/snippets/update_site_key.py +++ b/recaptcha_enterprise/snippets/update_site_key.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright 2021 Google Inc +# Copyright 2021 Google, Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. From c1a8d6387703fd26e9e64e600f3f12c90f030a69 Mon Sep 17 00:00:00 2001 From: Sampath M Date: Fri, 18 Nov 2022 14:57:44 +0100 Subject: [PATCH 46/63] Update import order in test_create_assessment.py --- recaptcha_enterprise/snippets/test_create_assessment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recaptcha_enterprise/snippets/test_create_assessment.py b/recaptcha_enterprise/snippets/test_create_assessment.py index cd9d7809b5e4..d902a61e8316 100644 --- a/recaptcha_enterprise/snippets/test_create_assessment.py +++ b/recaptcha_enterprise/snippets/test_create_assessment.py @@ -29,9 +29,9 @@ import pytest from selenium import webdriver -from webdriver_manager.chrome import ChromeDriverManager from selenium.webdriver.chrome.webdriver import WebDriver from selenium.webdriver.common.by import By +from webdriver_manager.chrome import ChromeDriverManager from annotate_assessment import annotate_assessment from create_assessment import create_assessment From 76e0283d817c98a2be6ebd63faf4f09bc98ab7d9 Mon Sep 17 00:00:00 2001 From: Sampath M Date: Fri, 18 Nov 2022 17:37:15 +0100 Subject: [PATCH 47/63] Update import order in test_create_assessment.py --- recaptcha_enterprise/snippets/test_create_assessment.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/recaptcha_enterprise/snippets/test_create_assessment.py b/recaptcha_enterprise/snippets/test_create_assessment.py index d902a61e8316..c8be7a40328f 100644 --- a/recaptcha_enterprise/snippets/test_create_assessment.py +++ b/recaptcha_enterprise/snippets/test_create_assessment.py @@ -29,6 +29,7 @@ import pytest from selenium import webdriver +from selenium.webdriver.chrome.service import Service from selenium.webdriver.chrome.webdriver import WebDriver from selenium.webdriver.common.by import By from webdriver_manager.chrome import ChromeDriverManager @@ -66,7 +67,7 @@ def browser() -> WebDriver: chrome_options.add_argument("--window-size=1420,1080") chrome_options.add_argument("--headless") chrome_options.add_argument("--disable-gpu") - browser = webdriver.Chrome(ChromeDriverManager().install(), + browser = webdriver.Chrome(service=Service(ChromeDriverManager().install()), chrome_options=chrome_options) yield browser browser.close() From 38c3649fc8c30cdd4e2e99d2c0b6118d9a4738ad Mon Sep 17 00:00:00 2001 From: Sampath Kumar Date: Fri, 18 Nov 2022 17:43:17 +0100 Subject: [PATCH 48/63] Update .github/CODEOWNERS Co-authored-by: Dan Lee <71398022+dandhlee@users.noreply.github.com> --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 21822e1e030a..47248dbf7c68 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -79,4 +79,4 @@ /datacatalog/**/* @GoogleCloudPlatform/python-samples-reviewers /kms/**/** @GoogleCloudPlatform/dee-infra @GoogleCloudPlatform/python-samples-reviewers /dataproc/**/** @GoogleCloudPlatform/cloud-dpes @GoogleCloudPlatform/python-samples-reviewers -recaptcha_enterprise/**/* @sitalakshmi @GoogleCloudPlatform/python-samples-reviewers \ No newline at end of file +recaptcha_enterprise/**/* @sita04 @GoogleCloudPlatform/python-samples-reviewers \ No newline at end of file From ac058cf9a704d2ed326678559d345e7db24958f4 Mon Sep 17 00:00:00 2001 From: Dan Lee <71398022+dandhlee@users.noreply.github.com> Date: Fri, 18 Nov 2022 11:43:20 -0500 Subject: [PATCH 49/63] Update .github/blunderbuss.yml --- .github/blunderbuss.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/blunderbuss.yml b/.github/blunderbuss.yml index d564b0017f67..33261ed01c28 100644 --- a/.github/blunderbuss.yml +++ b/.github/blunderbuss.yml @@ -187,7 +187,7 @@ assign_prs_by: - labels: - 'api: recaptchaenterprise' to: - - GoogleCloudPlatform//python-samples-reviewers + - sita04 assign_issues: - GoogleCloudPlatform/python-samples-owners From c7974d0e27874def6b447392a398e55fa9f362d5 Mon Sep 17 00:00:00 2001 From: Dan Lee <71398022+dandhlee@users.noreply.github.com> Date: Tue, 22 Nov 2022 11:49:38 -0600 Subject: [PATCH 50/63] chore(samples): add Selenium resources for Docker --- .kokoro/docker/Dockerfile | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.kokoro/docker/Dockerfile b/.kokoro/docker/Dockerfile index 7b2828256a88..8290f7b01e58 100644 --- a/.kokoro/docker/Dockerfile +++ b/.kokoro/docker/Dockerfile @@ -200,4 +200,21 @@ RUN useradd -d /h -u ${UID} ${USERNAME} # Allow nopasswd sudo RUN echo "${USERNAME} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers +# Install Chrome. +RUN curl https://dl-ssl.google.com/linux/linux_signing_key.pub -o /tmp/google.pub \ + && cat /tmp/google.pub | apt-key add -; rm /tmp/google.pub \ + && echo 'deb http://dl.google.com/linux/chrome/deb/ stable main' > /etc/apt/sources.list.d/google.list \ + && mkdir -p /usr/share/desktop-directories \ + && apt-get -y update && apt-get install -y google-chrome-stable + +# Disable the SUID sandbox so that Chrome can launch without being in a privileged container. +RUN dpkg-divert --add --rename --divert /opt/google/chrome/google-chrome.real /opt/google/chrome/google-chrome \ + && echo "#!/bin/bash\nexec /opt/google/chrome/google-chrome.real --no-sandbox --disable-setuid-sandbox \"\$@\"" > /opt/google/chrome/google-chrome \ + && chmod 755 /opt/google/chrome/google-chrome + +# Install Chrome Driver. +RUN mkdir -p /opt/selenium \ + && curl http://chromedriver.storage.googleapis.com/`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE`/chromedriver_linux64.zip -o /opt/selenium/chromedriver_linux64.zip \ + && cd /opt/selenium; unzip /opt/selenium/chromedriver_linux64.zip; rm -rf chromedriver_linux64.zip; ln -fs /opt/selenium/chromedriver /usr/local/bin/chromedriver; + CMD ["python3"] From 3331c03840d9c2da99d310301b7f1d2b8a5c97d4 Mon Sep 17 00:00:00 2001 From: Sampath M Date: Thu, 24 Nov 2022 17:25:54 +0100 Subject: [PATCH 51/63] Update blunderbuss.yml --- .github/blunderbuss.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/blunderbuss.yml b/.github/blunderbuss.yml index 7f37421aefe6..744c2a1dba16 100644 --- a/.github/blunderbuss.yml +++ b/.github/blunderbuss.yml @@ -159,6 +159,7 @@ assign_issues_by: - 'api: datacatalog' - 'api: dataproc' - 'api: clouderrorreporting' + - 'api: recaptchaenterprise' - 'api: talent' - 'api: vision' to: From c492f44b128e210b86defa7d585f03bce7d31200 Mon Sep 17 00:00:00 2001 From: Sampath M Date: Thu, 24 Nov 2022 17:25:54 +0100 Subject: [PATCH 52/63] Update blunderbuss.yml --- .github/blunderbuss.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/blunderbuss.yml b/.github/blunderbuss.yml index 7f37421aefe6..744c2a1dba16 100644 --- a/.github/blunderbuss.yml +++ b/.github/blunderbuss.yml @@ -159,6 +159,7 @@ assign_issues_by: - 'api: datacatalog' - 'api: dataproc' - 'api: clouderrorreporting' + - 'api: recaptchaenterprise' - 'api: talent' - 'api: vision' to: From 7c8ea4b8a160dd979d284d7ae639165ab82da3a6 Mon Sep 17 00:00:00 2001 From: Sampath M Date: Thu, 24 Nov 2022 17:28:38 +0100 Subject: [PATCH 53/63] Update blunderbuss.yml --- .github/blunderbuss.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/blunderbuss.yml b/.github/blunderbuss.yml index 744c2a1dba16..a5edfadd33e1 100644 --- a/.github/blunderbuss.yml +++ b/.github/blunderbuss.yml @@ -159,7 +159,6 @@ assign_issues_by: - 'api: datacatalog' - 'api: dataproc' - 'api: clouderrorreporting' - - 'api: recaptchaenterprise' - 'api: talent' - 'api: vision' to: @@ -193,7 +192,7 @@ assign_prs_by: - labels: - 'api: recaptchaenterprise' to: - - sita04 + - GoogleCloudPlatform/cloud-dpes assign_issues: - GoogleCloudPlatform/python-samples-owners From 57c7864eb6c96caae49637986377effd8dd345cc Mon Sep 17 00:00:00 2001 From: Sampath Kumar Date: Thu, 24 Nov 2022 17:32:43 +0100 Subject: [PATCH 54/63] Update .github/blunderbuss.yml Co-authored-by: Dan Lee <71398022+dandhlee@users.noreply.github.com> --- .github/blunderbuss.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/blunderbuss.yml b/.github/blunderbuss.yml index a5edfadd33e1..66bee24dec19 100644 --- a/.github/blunderbuss.yml +++ b/.github/blunderbuss.yml @@ -192,7 +192,7 @@ assign_prs_by: - labels: - 'api: recaptchaenterprise' to: - - GoogleCloudPlatform/cloud-dpes + - GoogleCloudPlatform/python-samples-reviewers assign_issues: - GoogleCloudPlatform/python-samples-owners From 0915526779458d5a3888104eb8fadc2ee03aac29 Mon Sep 17 00:00:00 2001 From: Sampath M Date: Mon, 28 Nov 2022 17:24:07 +0100 Subject: [PATCH 55/63] Update CODEOWNERS No addtions/deletions. Just sorted data. --- .github/CODEOWNERS | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 1cc6519360a1..bf42663b1a17 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -27,9 +27,9 @@ /billing/**/* @GoogleCloudPlatform/billing-samples-maintainers @GoogleCloudPlatform/python-samples-reviewers /blog/**/* @GoogleCloudPlatform/python-samples-reviewers /cdn/**/* @mpwarres @GoogleCloudPlatform/python-samples-reviewers -/cloudbuild/**/* @GoogleCloudPlatform/torus-dpe @GoogleCloudPlatform/python-samples-reviewers /cloud-sql/**/* @GoogleCloudPlatform/infra-db-dpes @GoogleCloudPlatform/python-samples-reviewers /cloud_tasks/**/* @GoogleCloudPlatform/infra-db-dpes @GoogleCloudPlatform/python-samples-reviewers +/cloudbuild/**/* @GoogleCloudPlatform/torus-dpe @GoogleCloudPlatform/python-samples-reviewers /codelabs/**/* @GoogleCloudPlatform/python-samples-reviewers /composer/**/* @leahecole @rachael-ds @rafalbiegacz @GoogleCloudPlatform/python-samples-reviewers /compute/**/* @m-strzelczyk @GoogleCloudPlatform/dee-infra @GoogleCloudPlatform/python-samples-reviewers @@ -37,14 +37,16 @@ /containeranalysis/**/* @GoogleCloudPlatform/aap-dpes @GoogleCloudPlatform/python-samples-reviewers /data-science-onramp/ @leahecole @bradmiro @GoogleCloudPlatform/python-samples-reviewers /datacatalog/**/* @GoogleCloudPlatform/python-samples-reviewers +/datacatalog/**/* @GoogleCloudPlatform/python-samples-reviewers /dataflow/**/* @davidcavazos @GoogleCloudPlatform/python-samples-reviewers /datalabeling/**/* @GoogleCloudPlatform/python-samples-reviewers @ivanmkc /dataproc/**/* @GoogleCloudPlatform/python-samples-reviewers +/dataproc/**/** @GoogleCloudPlatform/cloud-dpes @GoogleCloudPlatform/python-samples-reviewers /datastore/**/* @GoogleCloudPlatform/cloud-native-db-dpes @GoogleCloudPlatform/python-samples-reviewers /dns/**/* @GoogleCloudPlatform/python-samples-reviewers /endpoints/**/* @GoogleCloudPlatform/python-samples-reviewers -/eventarc/**/* @GoogleCloudPlatform/aap-dpes @GoogleCloudPlatform/python-samples-reviewers /error_reporting/**/* @GoogleCloudPlatform/python-samples-reviewers +/eventarc/**/* @GoogleCloudPlatform/aap-dpes @GoogleCloudPlatform/python-samples-reviewers /firestore/**/* @GoogleCloudPlatform/cloud-native-db-dpes @GoogleCloudPlatform/python-samples-reviewers /functions/**/* @GoogleCloudPlatform/aap-dpes @GoogleCloudPlatform/python-samples-reviewers /functions/spanner/* @GoogleCloudPlatform/api-spanner-python @GoogleCloudPlatform/python-samples-reviewers @@ -54,6 +56,7 @@ /iot/**/* @gcseh @GoogleCloudPlatform/api-iot @GoogleCloudPlatform/python-samples-reviewers /jobs/**/* @GoogleCloudPlatform/python-samples-reviewers /kms/**/** @GoogleCloudPlatform/dee-infra @GoogleCloudPlatform/python-samples-reviewers +/kms/**/** @GoogleCloudPlatform/dee-infra @GoogleCloudPlatform/python-samples-reviewers /kubernetes_engine/**/* @GoogleCloudPlatform/python-samples-reviewers /kubernetes_engine/django_tutorial/**/* @glasnt @GoogleCloudPlatform/python-samples-reviewers /language/**/* @GoogleCloudPlatform/dee-data-ai @GoogleCloudPlatform/python-samples-reviewers @@ -64,25 +67,21 @@ /monitoring/opencensus @yuriatgoogle @GoogleCloudPlatform/python-samples-reviewers /monitoring/prometheus @yuriatgoogle @GoogleCloudPlatform/python-samples-reviewers /notebooks/**/* @alixhami @GoogleCloudPlatform/python-samples-reviewers -/optimization/**/* @GoogleCloudPlatform/dee-data-ai @GoogleCloudPlatform/python-samples-reviewers /opencensus/**/* @GoogleCloudPlatform/python-samples-reviewers +/optimization/**/* @GoogleCloudPlatform/dee-data-ai @GoogleCloudPlatform/python-samples-reviewers /people-and-planet-ai/**/* @davidcavazos @GoogleCloudPlatform/python-samples-reviewers /profiler/**/* @GoogleCloudPlatform/python-samples-reviewers /pubsub/**/* @anguillanneuf @hongalex @GoogleCloudPlatform/python-samples-reviewers /pubsublite/**/* @anguillanneuf @hongalex @GoogleCloudPlatform/python-samples-reviewers +/recaptcha_enterprise/**/* @sita04 @GoogleCloudPlatform/python-samples-reviewers /run/**/* @GoogleCloudPlatform/aap-dpes @GoogleCloudPlatform/python-samples-reviewers /run/django/**/* @glasnt @GoogleCloudPlatform/aap-dpes @GoogleCloudPlatform/python-samples-reviewers /secretmanager/**/* @GoogleCloudPlatform/aap-dpes @GoogleCloudPlatform/python-samples-reviewers /storage/**/* @GoogleCloudPlatform/cloud-storage-dpes @GoogleCloudPlatform/python-samples-reviewers /storagetransfer/**/* @GoogleCloudPlatform/cloud-storage-dpes @GoogleCloudPlatform/python-samples-reviewers +/talent/**/* @GoogleCloudPlatform/python-samples-reviewers /texttospeech/**/* @GoogleCloudPlatform/dee-platform-ops @GoogleCloudPlatform/python-samples-reviewers /trace/**/* @ymotongpoo @GoogleCloudPlatform/python-samples-reviewers /translate/**/* @nicain @GoogleCloudPlatform/python-samples-reviewers -/talent/**/* @GoogleCloudPlatform/python-samples-reviewers /vision/**/* @GoogleCloudPlatform/python-samples-reviewers /workflows/**/* @GoogleCloudPlatform/python-samples-reviewers -/datacatalog/**/* @GoogleCloudPlatform/python-samples-reviewers -/kms/**/** @GoogleCloudPlatform/dee-infra @GoogleCloudPlatform/python-samples-reviewers -/dataproc/**/** @GoogleCloudPlatform/cloud-dpes @GoogleCloudPlatform/python-samples-reviewers -recaptcha_enterprise/**/* @sita04 @GoogleCloudPlatform/python-samples-reviewers - From feadb546149727ef6f29f60efcc002437c73a498 Mon Sep 17 00:00:00 2001 From: Sampath Kumar Date: Tue, 29 Nov 2022 12:17:24 +0100 Subject: [PATCH 56/63] Update noxfile_config.py Limit testing to latest versions only (3.9 and 3.10) --- recaptcha_enterprise/snippets/noxfile_config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recaptcha_enterprise/snippets/noxfile_config.py b/recaptcha_enterprise/snippets/noxfile_config.py index cfbd02d7f9d8..7b5e324aa28d 100644 --- a/recaptcha_enterprise/snippets/noxfile_config.py +++ b/recaptcha_enterprise/snippets/noxfile_config.py @@ -22,7 +22,7 @@ TEST_CONFIG_OVERRIDE = { # You can opt out from the test for specific Python versions. - "ignored_versions": ["2.7"], + "ignored_versions": ["2.7", "3.7", "3.8"], # Old samples are opted out of enforcing Python type hints # All new samples should feature them "enforce_type_hints": True, From 36e17f3e1c54809ff9d660c3c6636af8eaec00eb Mon Sep 17 00:00:00 2001 From: Sampath Kumar Date: Tue, 29 Nov 2022 19:58:43 +0100 Subject: [PATCH 57/63] Update noxfile_config.py --- recaptcha_enterprise/snippets/noxfile_config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recaptcha_enterprise/snippets/noxfile_config.py b/recaptcha_enterprise/snippets/noxfile_config.py index 7b5e324aa28d..cfbd02d7f9d8 100644 --- a/recaptcha_enterprise/snippets/noxfile_config.py +++ b/recaptcha_enterprise/snippets/noxfile_config.py @@ -22,7 +22,7 @@ TEST_CONFIG_OVERRIDE = { # You can opt out from the test for specific Python versions. - "ignored_versions": ["2.7", "3.7", "3.8"], + "ignored_versions": ["2.7"], # Old samples are opted out of enforcing Python type hints # All new samples should feature them "enforce_type_hints": True, From da16a09675422f15b2681af6a84863decf15194c Mon Sep 17 00:00:00 2001 From: Sampath Kumar Date: Tue, 29 Nov 2022 20:09:10 +0100 Subject: [PATCH 58/63] Update blunderbuss.yml --- .github/blunderbuss.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/blunderbuss.yml b/.github/blunderbuss.yml index 66bee24dec19..0ef350431fa6 100644 --- a/.github/blunderbuss.yml +++ b/.github/blunderbuss.yml @@ -160,6 +160,7 @@ assign_issues_by: - 'api: dataproc' - 'api: clouderrorreporting' - 'api: talent' + - 'api: recaptchaenterprise' - 'api: vision' to: - GoogleCloudPlatform/python-samples-reviewers @@ -189,10 +190,6 @@ assign_prs_by: - 'api: dataproc' to: - GoogleCloudPlatform/cloud-dpes -- labels: - - 'api: recaptchaenterprise' - to: - - GoogleCloudPlatform/python-samples-reviewers assign_issues: - GoogleCloudPlatform/python-samples-owners From e3ca91825b62a6d8d0f03a5d32348aaf255c4c78 Mon Sep 17 00:00:00 2001 From: rsamborski Date: Fri, 3 Feb 2023 11:38:16 +0100 Subject: [PATCH 59/63] Updates to CODEOWNERS and blunderbuss --- .github/CODEOWNERS | 2 +- .github/blunderbuss.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 10e707aed7a6..eeec1295f53a 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -80,7 +80,7 @@ /profiler/**/* @GoogleCloudPlatform/python-samples-reviewers /pubsub/**/* @anguillanneuf @hongalex @GoogleCloudPlatform/python-samples-reviewers /pubsublite/**/* @anguillanneuf @hongalex @GoogleCloudPlatform/python-samples-reviewers -/recaptcha_enterprise/**/* @sita04 @GoogleCloudPlatform/python-samples-reviewers +/recaptcha_enterprise/**/* @GoogleCloudPlatform/dee-infra @GoogleCloudPlatform/python-samples-reviewers /retail/**/* @GoogleCloudPlatform/cloud-retail-team @GoogleCloudPlatform/python-samples-reviewers /run/**/* @GoogleCloudPlatform/aap-dpes @GoogleCloudPlatform/python-samples-reviewers /run/django/**/* @glasnt @GoogleCloudPlatform/aap-dpes @GoogleCloudPlatform/python-samples-reviewers diff --git a/.github/blunderbuss.yml b/.github/blunderbuss.yml index 2c6149f9e9b1..746baf6b193c 100644 --- a/.github/blunderbuss.yml +++ b/.github/blunderbuss.yml @@ -154,6 +154,7 @@ assign_issues_by: - 'api: cloudkms' - 'api: secretmanager' - 'api: privateca' + - 'api: recaptchaenterprise' to: - GoogleCloudPlatform/dee-infra - labels: @@ -172,7 +173,6 @@ assign_issues_by: - 'api: dataproc' - 'api: clouderrorreporting' - 'api: talent' - - 'api: recaptchaenterprise' - 'api: vision' to: - GoogleCloudPlatform/python-samples-reviewers From dca90dcb8e2f724982ffd70d5b7b2551119d1962 Mon Sep 17 00:00:00 2001 From: rsamborski Date: Fri, 3 Feb 2023 11:38:36 +0100 Subject: [PATCH 60/63] Fixed deprecation warnings in tests --- recaptcha_enterprise/snippets/requirements-test.txt | 4 ++-- recaptcha_enterprise/snippets/test_create_assessment.py | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/recaptcha_enterprise/snippets/requirements-test.txt b/recaptcha_enterprise/snippets/requirements-test.txt index be782c6435b2..9381f1f6153f 100644 --- a/recaptcha_enterprise/snippets/requirements-test.txt +++ b/recaptcha_enterprise/snippets/requirements-test.txt @@ -1,5 +1,5 @@ -selenium==4.5.0 +selenium==4.8.0 Flask==2.2.2 -pytest==7.2.0 +pytest==7.2.1 pytest-flask==1.2.0 webdriver-manager==3.8.5 \ No newline at end of file diff --git a/recaptcha_enterprise/snippets/test_create_assessment.py b/recaptcha_enterprise/snippets/test_create_assessment.py index c8be7a40328f..9b2ed661a695 100644 --- a/recaptcha_enterprise/snippets/test_create_assessment.py +++ b/recaptcha_enterprise/snippets/test_create_assessment.py @@ -31,6 +31,7 @@ from selenium import webdriver from selenium.webdriver.chrome.service import Service from selenium.webdriver.chrome.webdriver import WebDriver +from selenium.webdriver.chrome.options import Options from selenium.webdriver.common.by import By from webdriver_manager.chrome import ChromeDriverManager @@ -62,13 +63,13 @@ def index() -> str: @pytest.fixture(scope="module") def browser() -> WebDriver: - chrome_options = webdriver.ChromeOptions() + chrome_options = Options() chrome_options.add_argument("--no-sandbox") chrome_options.add_argument("--window-size=1420,1080") chrome_options.add_argument("--headless") chrome_options.add_argument("--disable-gpu") browser = webdriver.Chrome(service=Service(ChromeDriverManager().install()), - chrome_options=chrome_options) + options=chrome_options) yield browser browser.close() From a23d79fca35f6065908556019a00fe2f00792a65 Mon Sep 17 00:00:00 2001 From: rsamborski Date: Fri, 3 Feb 2023 12:08:31 +0100 Subject: [PATCH 61/63] Fixed lint - import order --- recaptcha_enterprise/snippets/test_create_assessment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recaptcha_enterprise/snippets/test_create_assessment.py b/recaptcha_enterprise/snippets/test_create_assessment.py index 9b2ed661a695..590351a81357 100644 --- a/recaptcha_enterprise/snippets/test_create_assessment.py +++ b/recaptcha_enterprise/snippets/test_create_assessment.py @@ -29,9 +29,9 @@ import pytest from selenium import webdriver +from selenium.webdriver.chrome.options import Options from selenium.webdriver.chrome.service import Service from selenium.webdriver.chrome.webdriver import WebDriver -from selenium.webdriver.chrome.options import Options from selenium.webdriver.common.by import By from webdriver_manager.chrome import ChromeDriverManager From 37df22d99e0b1381d8bbc063521b5b5634309af9 Mon Sep 17 00:00:00 2001 From: rsamborski Date: Fri, 10 Feb 2023 11:04:16 +0100 Subject: [PATCH 62/63] CODEOWNERS team rename aap-dpes -> torus-dpe --- .github/CODEOWNERS | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 680f5770cbc7..a4826da2c606 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -15,9 +15,9 @@ /.kokoro/ @GoogleCloudPlatform/python-samples-owners /* @GoogleCloudPlatform/python-samples-owners -/appengine/**/* @GoogleCloudPlatform/aap-dpes @GoogleCloudPlatform/python-samples-reviewers -/appengine/standard/django/**/* @glasnt @GoogleCloudPlatform/aap-dpes @GoogleCloudPlatform/python-samples-reviewers -/appengine/flexible/django_cloudsql/**/* @glasnt @GoogleCloudPlatform/aap-dpes @GoogleCloudPlatform/python-samples-reviewers +/appengine/**/* @GoogleCloudPlatform/torus-dpe @GoogleCloudPlatform/python-samples-reviewers +/appengine/standard/django/**/* @glasnt @GoogleCloudPlatform/torus-dpe @GoogleCloudPlatform/python-samples-reviewers +/appengine/flexible/django_cloudsql/**/* @glasnt @GoogleCloudPlatform/torus-dpe @GoogleCloudPlatform/python-samples-reviewers /appengine/standard_python3/spanner/* @GoogleCloudPlatform/api-spanner-python @GoogleCloudPlatform/python-samples-reviewers /asset/**/* @GoogleCloudPlatform/python-samples-reviewers /auth/**/* @arithmetic1728 @GoogleCloudPlatform/python-samples-reviewers @@ -35,7 +35,7 @@ /composer/**/* @leahecole @rachael-ds @GoogleCloudPlatform/cloud-dpes-composer @GoogleCloudPlatform/python-samples-reviewers /compute/**/* @m-strzelczyk @GoogleCloudPlatform/dee-infra @GoogleCloudPlatform/python-samples-reviewers /container/**/* @GoogleCloudPlatform/dee-platform-ops @GoogleCloudPlatform/python-samples-reviewers -/containeranalysis/**/* @GoogleCloudPlatform/aap-dpes @GoogleCloudPlatform/python-samples-reviewers +/containeranalysis/**/* @GoogleCloudPlatform/torus-dpe @GoogleCloudPlatform/python-samples-reviewers /contentwarehouse/**/* @GoogleCloudPlatform/dee-data-ai @GoogleCloudPlatform/python-samples-reviewers /data-science-onramp/ @leahecole @bradmiro @GoogleCloudPlatform/python-samples-reviewers /datacatalog/**/* @GoogleCloudPlatform/python-samples-reviewers @@ -51,11 +51,11 @@ /documentai/**/* @GoogleCloudPlatform/dee-data-ai @GoogleCloudPlatform/python-samples-reviewers /endpoints/**/* @GoogleCloudPlatform/python-samples-reviewers /enterpriseknowledgegraph/**/* @GoogleCloudPlatform/dee-data-ai @GoogleCloudPlatform/python-samples-reviewers -/eventarc/**/* @GoogleCloudPlatform/aap-dpes @GoogleCloudPlatform/python-samples-reviewers +/eventarc/**/* @GoogleCloudPlatform/torus-dpe @GoogleCloudPlatform/python-samples-reviewers /error_reporting/**/* @GoogleCloudPlatform/python-samples-reviewers -/eventarc/**/* @GoogleCloudPlatform/aap-dpes @GoogleCloudPlatform/python-samples-reviewers +/eventarc/**/* @GoogleCloudPlatform/torus-dpe @GoogleCloudPlatform/python-samples-reviewers /firestore/**/* @GoogleCloudPlatform/cloud-native-db-dpes @GoogleCloudPlatform/python-samples-reviewers -/functions/**/* @GoogleCloudPlatform/aap-dpes @GoogleCloudPlatform/python-samples-reviewers +/functions/**/* @GoogleCloudPlatform/torus-dpe @GoogleCloudPlatform/python-samples-reviewers /functions/spanner/* @GoogleCloudPlatform/api-spanner-python @GoogleCloudPlatform/python-samples-reviewers /healthcare/**/* @noerog @GoogleCloudPlatform/python-samples-reviewers /iam/api-client/**/* @GoogleCloudPlatform/python-samples-reviewers @@ -84,9 +84,9 @@ /pubsublite/**/* @anguillanneuf @hongalex @GoogleCloudPlatform/python-samples-reviewers /recaptcha_enterprise/**/* @GoogleCloudPlatform/dee-infra @GoogleCloudPlatform/python-samples-reviewers /retail/**/* @GoogleCloudPlatform/cloud-retail-team @GoogleCloudPlatform/python-samples-reviewers -/run/**/* @GoogleCloudPlatform/aap-dpes @GoogleCloudPlatform/python-samples-reviewers -/run/django/**/* @glasnt @GoogleCloudPlatform/aap-dpes @GoogleCloudPlatform/python-samples-reviewers -/secretmanager/**/* @GoogleCloudPlatform/aap-dpes @GoogleCloudPlatform/python-samples-reviewers +/run/**/* @GoogleCloudPlatform/torus-dpe @GoogleCloudPlatform/python-samples-reviewers +/run/django/**/* @glasnt @GoogleCloudPlatform/torus-dpe @GoogleCloudPlatform/python-samples-reviewers +/secretmanager/**/* @GoogleCloudPlatform/torus-dpe @GoogleCloudPlatform/python-samples-reviewers /securitycenter/**/* @GoogleCloudPlatform/dee-infra @GoogleCloudPlatform/python-samples-reviewers /speech/**/* @GoogleCloudPlatform/dee-data-ai @GoogleCloudPlatform/python-samples-reviewers /storage/**/* @GoogleCloudPlatform/cloud-storage-dpes @GoogleCloudPlatform/python-samples-reviewers From ae267acd489a9d3d7b026f31ddfcf3f075566a7f Mon Sep 17 00:00:00 2001 From: rsamborski Date: Tue, 28 Feb 2023 12:13:48 +0100 Subject: [PATCH 63/63] CODEOWNERS clean-up --- .github/CODEOWNERS | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index a4826da2c606..b6367cb06f9b 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -28,9 +28,9 @@ /billing/**/* @GoogleCloudPlatform/billing-samples-maintainers @GoogleCloudPlatform/python-samples-reviewers /blog/**/* @GoogleCloudPlatform/python-samples-reviewers /cdn/**/* @mpwarres @GoogleCloudPlatform/python-samples-reviewers +/cloudbuild/**/* @GoogleCloudPlatform/torus-dpe @GoogleCloudPlatform/python-samples-reviewers /cloud-sql/**/* @GoogleCloudPlatform/infra-db-dpes @GoogleCloudPlatform/python-samples-reviewers /cloud_tasks/**/* @GoogleCloudPlatform/infra-db-dpes @GoogleCloudPlatform/python-samples-reviewers -/cloudbuild/**/* @GoogleCloudPlatform/torus-dpe @GoogleCloudPlatform/python-samples-reviewers /codelabs/**/* @GoogleCloudPlatform/python-samples-reviewers /composer/**/* @leahecole @rachael-ds @GoogleCloudPlatform/cloud-dpes-composer @GoogleCloudPlatform/python-samples-reviewers /compute/**/* @m-strzelczyk @GoogleCloudPlatform/dee-infra @GoogleCloudPlatform/python-samples-reviewers @@ -39,11 +39,9 @@ /contentwarehouse/**/* @GoogleCloudPlatform/dee-data-ai @GoogleCloudPlatform/python-samples-reviewers /data-science-onramp/ @leahecole @bradmiro @GoogleCloudPlatform/python-samples-reviewers /datacatalog/**/* @GoogleCloudPlatform/python-samples-reviewers -/datacatalog/**/* @GoogleCloudPlatform/python-samples-reviewers /dataflow/**/* @davidcavazos @GoogleCloudPlatform/python-samples-reviewers /datalabeling/**/* @GoogleCloudPlatform/python-samples-reviewers @ivanmkc /dataproc/**/* @GoogleCloudPlatform/python-samples-reviewers -/dataproc/**/** @GoogleCloudPlatform/cloud-dpes @GoogleCloudPlatform/python-samples-reviewers /datastore/**/* @GoogleCloudPlatform/cloud-native-db-dpes @GoogleCloudPlatform/python-samples-reviewers /dialogflow/**/* @GoogleCloudPlatform/dee-data-ai @GoogleCloudPlatform/python-samples-reviewers /dialogflow-cx/**/* @GoogleCloudPlatform/dee-data-ai @GoogleCloudPlatform/python-samples-reviewers @@ -53,7 +51,6 @@ /enterpriseknowledgegraph/**/* @GoogleCloudPlatform/dee-data-ai @GoogleCloudPlatform/python-samples-reviewers /eventarc/**/* @GoogleCloudPlatform/torus-dpe @GoogleCloudPlatform/python-samples-reviewers /error_reporting/**/* @GoogleCloudPlatform/python-samples-reviewers -/eventarc/**/* @GoogleCloudPlatform/torus-dpe @GoogleCloudPlatform/python-samples-reviewers /firestore/**/* @GoogleCloudPlatform/cloud-native-db-dpes @GoogleCloudPlatform/python-samples-reviewers /functions/**/* @GoogleCloudPlatform/torus-dpe @GoogleCloudPlatform/python-samples-reviewers /functions/spanner/* @GoogleCloudPlatform/api-spanner-python @GoogleCloudPlatform/python-samples-reviewers @@ -64,7 +61,6 @@ /iot/**/* @gcseh @GoogleCloudPlatform/api-iot @GoogleCloudPlatform/python-samples-reviewers /jobs/**/* @GoogleCloudPlatform/python-samples-reviewers /kms/**/** @GoogleCloudPlatform/dee-infra @GoogleCloudPlatform/python-samples-reviewers -/kms/**/** @GoogleCloudPlatform/dee-infra @GoogleCloudPlatform/python-samples-reviewers /kubernetes_engine/**/* @GoogleCloudPlatform/python-samples-reviewers /kubernetes_engine/django_tutorial/**/* @glasnt @GoogleCloudPlatform/python-samples-reviewers /language/**/* @GoogleCloudPlatform/dee-data-ai @GoogleCloudPlatform/python-samples-reviewers @@ -76,8 +72,8 @@ /monitoring/opencensus @yuriatgoogle @GoogleCloudPlatform/dee-observability @GoogleCloudPlatform/python-samples-reviewers /monitoring/prometheus @yuriatgoogle @GoogleCloudPlatform/dee-observability @GoogleCloudPlatform/python-samples-reviewers /notebooks/**/* @alixhami @GoogleCloudPlatform/python-samples-reviewers -/opencensus/**/* @GoogleCloudPlatform/python-samples-reviewers /optimization/**/* @GoogleCloudPlatform/dee-data-ai @GoogleCloudPlatform/python-samples-reviewers +/opencensus/**/* @GoogleCloudPlatform/python-samples-reviewers /people-and-planet-ai/**/* @davidcavazos @GoogleCloudPlatform/python-samples-reviewers /profiler/**/* @GoogleCloudPlatform/python-samples-reviewers /pubsub/**/* @anguillanneuf @hongalex @GoogleCloudPlatform/python-samples-reviewers @@ -91,10 +87,10 @@ /speech/**/* @GoogleCloudPlatform/dee-data-ai @GoogleCloudPlatform/python-samples-reviewers /storage/**/* @GoogleCloudPlatform/cloud-storage-dpes @GoogleCloudPlatform/python-samples-reviewers /storagetransfer/**/* @GoogleCloudPlatform/cloud-storage-dpes @GoogleCloudPlatform/python-samples-reviewers -/talent/**/* @GoogleCloudPlatform/python-samples-reviewers /texttospeech/**/* @GoogleCloudPlatform/dee-data-ai @GoogleCloudPlatform/python-samples-reviewers /trace/**/* @ymotongpoo @GoogleCloudPlatform/dee-observability @GoogleCloudPlatform/python-samples-reviewers /translate/**/* @nicain @GoogleCloudPlatform/python-samples-reviewers +/talent/**/* @GoogleCloudPlatform/python-samples-reviewers /vision/**/* @GoogleCloudPlatform/python-samples-reviewers /workflows/**/* @GoogleCloudPlatform/python-samples-reviewers /privateca/**/* @GoogleCloudPlatform/dee-infra @GoogleCloudPlatform/python-samples-reviewers