{"library":"atlassian-python-api","code":"import os\nfrom atlassian import Jira\n\n# For Jira Cloud, use API Token authentication.\n# Generate an API token at: https://id.atlassian.com/manage-profile/security/api-tokens\nJIRA_URL = os.environ.get('ATLASSIAN_JIRA_URL', 'https://your-domain.atlassian.net')\nJIRA_EMAIL = os.environ.get('ATLASSIAN_JIRA_EMAIL', 'your_email@example.com')\nJIRA_API_TOKEN = os.environ.get('ATLASSIAN_JIRA_API_TOKEN', 'YOUR_API_TOKEN')\n\nif not all([JIRA_URL, JIRA_EMAIL, JIRA_API_TOKEN]):\n    print(\"Please set ATLASSIAN_JIRA_URL, ATLASSIAN_JIRA_EMAIL, and ATLASSIAN_JIRA_API_TOKEN environment variables.\")\nelse:\n    try:\n        jira = Jira(\n            url=JIRA_URL,\n            username=JIRA_EMAIL,\n            password=JIRA_API_TOKEN, # API token for Cloud\n            cloud=True # Important for Jira Cloud\n        )\n\n        # Test connection by getting current user\n        current_user = jira.myself()\n        print(f\"Successfully connected to Jira. Current user: {current_user['displayName']}\")\n\n        # Example: Get all projects\n        projects = jira.get_all_projects(start=0, limit=5)\n        print(f\"First 5 projects: {[p['name'] for p in projects]}\")\n\n    except Exception as e:\n        print(f\"Error connecting to Jira or fetching data: {e}\")","lang":"python","description":"This quickstart demonstrates how to connect to Jira Cloud using an API token, which is the recommended authentication method for cloud instances. It then retrieves the current user's display name and lists the first five available projects to verify the connection and basic functionality. Environment variables are used for sensitive credentials.","tag":null,"tag_description":null,"last_tested":"2026-04-24","results":[{"runtime":"python:3.10-alpine","exit_code":0},{"runtime":"python:3.10-slim","exit_code":0},{"runtime":"python:3.11-alpine","exit_code":0},{"runtime":"python:3.11-slim","exit_code":0},{"runtime":"python:3.12-alpine","exit_code":0},{"runtime":"python:3.12-slim","exit_code":0},{"runtime":"python:3.13-alpine","exit_code":0},{"runtime":"python:3.13-slim","exit_code":0},{"runtime":"python:3.9-alpine","exit_code":0},{"runtime":"python:3.9-slim","exit_code":0}]}