Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

chore(deps): update dependency webdriver-manager to v4.0.2 #12659

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion 8 recaptcha_enterprise/snippets/create_assessment.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@


def create_assessment(
project_id: str, recaptcha_site_key: str, token: str, recaptcha_action: str, user_ip_address: str, user_agent: str, ja3: str
project_id: str,
recaptcha_site_key: str,
token: str,
recaptcha_action: str,
user_ip_address: str,
user_agent: str,
ja3: str,
) -> Assessment:
"""Create an assessment to analyze the risk of a UI action.
Args:
Expand Down
2 changes: 1 addition & 1 deletion 2 recaptcha_enterprise/snippets/requirements-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ Flask==2.2.2
Werkzeug==2.3.7
pytest==8.2.0
pytest-flask==1.2.0
webdriver-manager==4.0.1
webdriver-manager==4.0.2
20 changes: 17 additions & 3 deletions 20 recaptcha_enterprise/snippets/test_create_assessment.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,14 @@ def test_assessment(
# Get token.
token, action = get_token(recaptcha_site_key, browser)
# Create assessment.
assessment_response = assess_token(recaptcha_site_key, token=token, action=action, user_ip_address="", user_agent="", ja3="")
assessment_response = assess_token(
recaptcha_site_key,
token=token,
action=action,
user_ip_address="",
user_agent="",
ja3="",
)
score = str(assessment_response.risk_analysis.score)
client = recaptchaenterprise_v1.RecaptchaEnterpriseServiceClient()
# Parse the assessment_response.name which is of the format:
Expand Down Expand Up @@ -152,15 +159,22 @@ def get_token(recaptcha_site_key: str, browser: WebDriver) -> tuple:
return token, action


def assess_token(recaptcha_site_key: str, token: str, action: str, user_ip_address: str, user_agent: str, ja3: str) -> Assessment:
def assess_token(
recaptcha_site_key: str,
token: str,
action: str,
user_ip_address: str,
user_agent: str,
ja3: str,
) -> Assessment:
return create_assessment(
project_id=GOOGLE_CLOUD_PROJECT,
recaptcha_site_key=recaptcha_site_key,
token=token,
recaptcha_action=action,
user_ip_address=user_ip_address,
user_agent=user_agent,
ja3=ja3
ja3=ja3,
)


Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.