๐Ÿ“ฆ EqualifyEverything / crawler

๐Ÿ“„ auth.py ยท 19 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19import os

API_KEY = os.environ.get("API_KEY", "CrawlTheWorld")

def validate_api_key(api_key):
    """
    Authenticates the API key against the stored API key.

    Args:
        api_key (str): The API key to authenticate.

    Returns:
        tuple: A tuple containing a boolean indicating if the API key is valid and an error message if it's not.
    """
    if api_key == API_KEY:
        return True, None
    else:
        return False, "๐Ÿ›‘ Invalid API Key! You Shall NOT PASS."