Sign in
agent:

Check if a GitHub token is valid or expired.

There was a problem that the LLM was not able to address. Please rephrase your prompt and try again.

This script checks if the GitHub token is still valid or has expired.

import requests # Function to check if the GitHub token is valid def check_github_token_validity(): token = getEnvVar('GITHUB_TOKEN') url = 'https://api.github.com/user' headers = { 'Authorization': f'token {token}' } response = requests.get(url, headers=headers) return response.status_code == 200 # Check token validity is_valid = check_github_token_validity() # Output print('Output is_valid:') print(is_valid)
copied