How to append a video already have in attachment section to the description of jira issue via code?

This is the code to attach the video to the description that video already in the attachments need to append the video to be playable

def update_results_section(issue_key, section_name, file_urls):
    """
    Updates a specific section of a Jira issue with video URLs embedded as previews using HTML iframes.

    :param issue_key: The Jira issue key
    :param section_name: The section name to update (e.g., 'Actual Results', 'Expected Results')
    :param file_urls: List of video URLs to add to the section
    """
    if not file_urls:
        print(f"No file URLs provided to update the '{section_name}' section.")
        return

    # Retrieve issue details
    jira_get_issue_url = f"{jira_base_url}/rest/api/2/issue/{issue_key}"
    response = requests.get(jira_get_issue_url, auth=(jira_username, jira_api_token))

    if response.status_code != 200:
        print(f"Failed to retrieve issue details for {issue_key} (Status Code: {response.status_code}).")
        return

    issue_data = response.json()
    current_description = issue_data['fields'].get('description', "")

    # Check if the section exists
    section_header = f"*{section_name}:*"
    video_section = "n".join([f"<h2>Video Preview</h2><a href='{url}' target='_blank'>{url}</a>" for url in file_urls])

    if section_header in current_description:
        print(f"Found '{section_name}' section in the description. Appending videos...")
        start_idx = current_description.find(section_header) + len(section_header)
        before_append = current_description[:start_idx].strip()
        after_append = current_description[start_idx:].strip()

        updated_description = (
                f"{before_append}n"
                + "n".join([f"<h2>Video Preview</h2><a href='{url}' target='_blank'>{url}</a>" for url in file_urls])
                + f"n{after_append}"
        )
    else:
        print(f"'{section_name}' section not found. Adding a new section.")
        updated_description = current_description + f"nn{section_header}n"
        updated_description += video_section

    # Prepare payload and update
    update_payload = {"fields": {"description": updated_description}}
    jira_update_url = f"{jira_base_url}/rest/api/2/issue/{issue_key}"
    try:
        update_response = requests.put(
            jira_update_url,
            headers={"Content-Type": "application/json"},
            auth=(jira_username, jira_api_token),
            data=json.dumps(update_payload)
        )
        if update_response.status_code == 204:
            print(f"Successfully updated the '{section_name}' section for issue {issue_key}.n")
            messagebox.showinfo("Confirmation", "Videos have been successfully attached!")
        else:
            print(f"Failed to update issue {issue_key} (Status Code: {update_response.status_code}).")
            print(update_response.text)
    except requests.exceptions.RequestException as e:
        print(f"An error occurred while updating the issue: {e}")

i tried it using markdown symbol and it cannot be playable it can only add as clickable link how to add the video to be playablein the Actual Result Section

New contributor

Sudam Praveen is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật