Annoter une évaluation
Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Annotez une évaluation pour envoyer des commentaires sur l'exactitude de l'analyse effectuée par reCAPTCHA Enterprise.
Exemple de code
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],[],[],[],null,["# Annotate an assessment to provide feedback on the correctness of the analysis made by reCAPTCHA Enterprise.\n\nCode sample\n-----------\n\n### Java\n\n\nTo authenticate to reCAPTCHA, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n\n import com.google.cloud.recaptchaenterprise.v1.https://cloud.google.com/java/docs/reference/google-cloud-recaptchaenterprise/latest/com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient.html;\n import com.google.recaptchaenterprise.v1.https://cloud.google.com/java/docs/reference/google-cloud-recaptchaenterprise/latest/com.google.recaptchaenterprise.v1.AnnotateAssessmentRequest.html;\n import com.google.recaptchaenterprise.v1.https://cloud.google.com/java/docs/reference/google-cloud-recaptchaenterprise/latest/com.google.recaptchaenterprise.v1.AnnotateAssessmentRequest.html.https://cloud.google.com/java/docs/reference/google-cloud-recaptchaenterprise/latest/com.google.recaptchaenterprise.v1.AnnotateAssessmentRequest.Annotation.html;\n import com.google.recaptchaenterprise.v1.https://cloud.google.com/java/docs/reference/google-cloud-recaptchaenterprise/latest/com.google.recaptchaenterprise.v1.AnnotateAssessmentRequest.html.https://cloud.google.com/java/docs/reference/google-cloud-recaptchaenterprise/latest/com.google.recaptchaenterprise.v1.AnnotateAssessmentRequest.Reason.html;\n import com.google.recaptchaenterprise.v1.https://cloud.google.com/java/docs/reference/google-cloud-recaptchaenterprise/latest/com.google.recaptchaenterprise.v1.AnnotateAssessmentResponse.html;\n import com.google.recaptchaenterprise.v1.https://cloud.google.com/java/docs/reference/google-cloud-recaptchaenterprise/latest/com.google.recaptchaenterprise.v1.AssessmentName.html;\n import java.io.IOException;\n\n public class AnnotateAssessment {\n\n public static void main(String[] args) throws IOException {\n // TODO(developer): Replace these variables before running the sample.\n String projectID = \"project-id\";\n String assessmentId = \"assessment-id\";\n annotateAssessment(projectID, assessmentId);\n }\n\n /**\n * Pre-requisite: Create an assessment before annotating.\n *\n * \u003cp\u003eAnnotate an assessment to provide feedback on the correctness of recaptcha prediction.\n *\n * @param projectID: GCloud Project id\n * @param assessmentId: Value of the 'name' field returned from the CreateAssessment call.\n */\n public static void annotateAssessment(String projectID, String assessmentId) throws IOException {\n // Initialize client that will be used to send requests. This client only needs to be created\n // once, and can be reused for multiple requests. After completing all of your requests, call\n // the `client.close()` method on the client to safely\n // clean up any remaining background resources.\n try (https://cloud.google.com/java/docs/reference/google-cloud-recaptchaenterprise/latest/com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient.html client = https://cloud.google.com/java/docs/reference/google-cloud-recaptchaenterprise/latest/com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient.html.create()) {\n // Build the annotation request.\n // For more info on when/how to annotate, see:\n // https://cloud.google.com/recaptcha-enterprise/docs/annotate-assessment#when_to_annotate\n https://cloud.google.com/java/docs/reference/google-cloud-recaptchaenterprise/latest/com.google.recaptchaenterprise.v1.AnnotateAssessmentRequest.html annotateAssessmentRequest =\n https://cloud.google.com/java/docs/reference/google-cloud-recaptchaenterprise/latest/com.google.recaptchaenterprise.v1.AnnotateAssessmentRequest.html.newBuilder()\n .setName(https://cloud.google.com/java/docs/reference/google-cloud-recaptchaenterprise/latest/com.google.recaptchaenterprise.v1.AssessmentName.html.of(projectID, assessmentId).toString())\n .https://cloud.google.com/java/docs/reference/google-cloud-recaptchaenterprise/latest/com.google.recaptchaenterprise.v1.AnnotateAssessmentRequest.Builder.html#com_google_recaptchaenterprise_v1_AnnotateAssessmentRequest_Builder_setAnnotation_com_google_recaptchaenterprise_v1_AnnotateAssessmentRequest_Annotation_(https://cloud.google.com/java/docs/reference/google-cloud-recaptchaenterprise/latest/com.google.recaptchaenterprise.v1.AnnotateAssessmentRequest.Annotation.html.FRAUDULENT)\n .addReasons(https://cloud.google.com/java/docs/reference/google-cloud-recaptchaenterprise/latest/com.google.recaptchaenterprise.v1.AnnotateAssessmentRequest.Reason.html.FAILED_TWO_FACTOR)\n .build();\n\n // Empty response is sent back.\n https://cloud.google.com/java/docs/reference/google-cloud-recaptchaenterprise/latest/com.google.recaptchaenterprise.v1.AnnotateAssessmentResponse.html response = client.annotateAssessment(annotateAssessmentRequest);\n System.out.println(\"Annotated response sent successfully ! \" + response);\n }\n }\n }\n\n### Python\n\n\nTo authenticate to reCAPTCHA, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n from google.cloud import https://cloud.google.com/python/docs/reference/recaptchaenterprise/latest/\n\n\n def annotate_assessment(project_id: str, assessment_id: str) -\u003e None:\n \"\"\"Pre-requisite: Create an assessment before annotating.\n Annotate an assessment to provide feedback on the correctness of recaptcha prediction.\n Args:\n project_id: Google Cloud Project ID\n assessment_id: Value of the 'name' field returned from the create_assessment() call.\n \"\"\"\n\n client = https://cloud.google.com/python/docs/reference/recaptchaenterprise/latest/.https://cloud.google.com/python/docs/reference/recaptchaenterprise/latest/google.cloud.recaptchaenterprise_v1.services.recaptcha_enterprise_service.RecaptchaEnterpriseServiceClient.html()\n\n assessment_name = f\"projects/{project_id}/assessments/{assessment_id}\"\n # Build the annotation request.\n # For more info on when/how to annotate, see:\n # https://cloud.google.com/recaptcha-enterprise/docs/annotate-assessment#when_to_annotate\n request = https://cloud.google.com/python/docs/reference/recaptchaenterprise/latest/.https://cloud.google.com/python/docs/reference/recaptchaenterprise/latest/google.cloud.recaptchaenterprise_v1.types.AnnotateAssessmentRequest.html()\n request.name = assessment_name\n request.annotation = request.https://cloud.google.com/python/docs/reference/recaptchaenterprise/latest/google.cloud.recaptchaenterprise_v1.types.AnnotateAssessmentRequest.Annotation.html.FRAUDULENT\n request.reasons = [request.https://cloud.google.com/python/docs/reference/recaptchaenterprise/latest/google.cloud.recaptchaenterprise_v1.types.AnnotateAssessmentRequest.Reason.html.FAILED_TWO_FACTOR]\n\n # Empty response is sent back.\n client.https://cloud.google.com/python/docs/reference/recaptchaenterprise/latest/google.cloud.recaptchaenterprise_v1.services.recaptcha_enterprise_service.RecaptchaEnterpriseServiceClient.html#google_cloud_recaptchaenterprise_v1_services_recaptcha_enterprise_service_RecaptchaEnterpriseServiceClient_annotate_assessment(request)\n print(\"Annotated response sent successfully ! \")\n\nWhat's next\n-----------\n\n\nTo search and filter code samples for other Google Cloud products, see the\n[Google Cloud sample browser](/docs/samples?product=recaptcha_enterprise)."]]