MCPcopy Create free account
hub / github.com/internetarchive/openlibrary / token_verification

Function token_verification

scripts/gh_scripts/issue_comment_bot.py:355–367  ·  view source on GitHub ↗

Checks that the tokens required for this job to run are available in the environment. A GitHub token is always required. A Slack token is required only if a `slack_channel` is specified. :param slack_channel: Channel to publish the digest. Publish step is skipped if this is an empty

(slack_channel: str = "")

Source from the content-addressed store, hash-verified

353
354
355def token_verification(slack_channel: str = ""):
356 """
357 Checks that the tokens required for this job to run are available in the environment.
358
359 A GitHub token is always required. A Slack token is required only if a `slack_channel` is specified.
360
361 :param slack_channel: Channel to publish the digest. Publish step is skipped if this is an empty string.
362 :raises AuthenticationError: When required token is missing from the environment.
363 """
364 if not os.environ.get("GITHUB_TOKEN", ""):
365 raise AuthenticationError("Required GitHub token not found in environment.")
366 if slack_channel and not os.environ.get("SLACK_TOKEN", ""):
367 raise AuthenticationError("Slack token must be included in environment if Slack channel is provided.")
368
369
370def start_job():

Callers 1

start_jobFunction · 0.85

Calls 2

AuthenticationErrorClass · 0.85
getMethod · 0.45

Tested by

no test coverage detected