import os
import requests

# Remove unused import
# Break long URL into multiple lines using parentheses
JOIN_ORG_URL = (
    os.getenv("JOIN_ORG_URL")
    or "https://huggingface.co/organizations/agents-course-finishers/share/"
    "XmxAybhNLOogLeBzZnBUVbazpTlDETqFId"
)


def join_finishers_org():
    """Join the finishers organization using the provided auth cookie.

    Args:
        user_auth_cookie (str): User's authentication cookie

    Returns:
        bool: True if join was successful, False otherwise
    """

    # If you need to include a cookie for authentication, you can do so here
    # Otherwise, you can leave the headers empty
    headers = {
        # "Cookie": "session=abc123def456ghi789jkl012mno345pqr678"  # Uncomment and add your cookie if needed
    }

    # Send the POST request
    response = requests.post(url=JOIN_ORG_URL, headers=headers)

    # Check the response status code
    if response.status_code == 200:
        print("Successfully joined the organization!")
    else:
        print(f"Failed to join the organization. Status code: {response.status_code}")