Created
April 1, 2024 07:29
-
-
Save NIXKnight/b1d260c2b45392248d0aa80f89b99f6c to your computer and use it in GitHub Desktop.
Check if a Cloudflare Token is valid by using Cloudflare API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
# Replace 'your_cloudflare_api_token_here' with your actual Cloudflare API token | |
api_token = "your_cloudflare_api_token_here" | |
# The URL for the Cloudflare API endpoint to check user details | |
url = "https://api.cloudflare.com/client/v4/user/tokens/verify" | |
# The headers including the API token for authentication | |
headers = { | |
"Authorization": f"Bearer {api_token}", | |
"Content-Type": "application/json", | |
} | |
# Make the GET request to the Cloudflare API | |
response = requests.get(url, headers=headers) | |
print(f"{response.text}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment