python - 如何使用 Python 将 Excel 数据导出到 JIRA?
问题描述
我应该使用哪个函数来调用或更新单元格值并直接更新到 JIRA?
我有一个 excel 文件,想将其数据导出到 JIRA。我正在使用jira
模块进行身份验证。
这是我从 JIRA 导出数据的脚本
import jira
from jira import JIRA
import openpyxl
workbook = openpyxl.load_workbook('C:\\Users\\Skapse\\PycharmProjects\\Import_data.xlsx')
# Get today's date
from datetime import date
today = str(date.today())
print(today)
# Authentiaction: User's credentials to be used.
username_TE = 'xxxxxxx'
password_TE = 'xxxxxxx'
# login = cryptography.fernet
server_TE = 'https://jira.technica-engineering.net/'
auth_jira_TE = JIRA(basic_auth=(username_TE, password_TE), options={'server': server_TE})
# Open Excel workbook
vk = openpyxl.Workbook()
sh = vk.active
sh = workbook.active
sh.title = today + "Data_Frm_Jira"
wb_location = "C:\\Users\\Skapse\\PycharmProjects\\Import_data.xlsx\\"
# Write headings and then write the jira data
sh.cell(1, 1).value = "Object_Ids"
sh.cell(1, 2).value = "Summary"
sh.cell(1, 3).value = "Assignee"
sh.cell(1, 4).value = "Issuetype"
sh.cell(1, 5).value = "Reporter"
sh.cell(1, 6).value = "Status"
sh.cell(1, 7).value = "Due_Date"
sh.cell(1, 8).value = "Resolution"
cell_value = sh.cell(2, 6).value
cell_val2 = sh.cell(2, 5).value
print(cell_value)
print(cell_val2)
# Get all the issues. Apply filter.
all_proj_issues_but_mine = auth_jira_TE.search_issues('project=CSQA and reporter = skapse and issuetype = "Task" and status = "OPEN"', startAt=0, maxResults=False)
print(all_proj_issues_but_mine)
row_counter = 1
#to call the cell values
for issue in all_proj_issues_but_mine:
print("Test", issue)
row_counter = row_counter + 1
J_Assignee = str(issue.fields.assignee)
print(J_Assignee)
Resolution = str(issue.fields.resolution)
print(Resolution)
summary = (issue.fields.summary)
print(summary)
# below are the cell details -
sh.cell(row_counter, 3).value = J_Assignee
sh.cell(row_counter, 8).value = Resolution
解决方案
推荐阅读
- google-api - 使用适用于 .NET Core 的 Google.Apis.Core,当我指定空格 =“照片”时,为什么在我的 Google 照片中看不到照片列表?
- javascript - 每次 webpack 更新后必须重新连接游戏手柄
- javascript - 链表替换和删除
- java - 如何在 SQL (JPA) 中使用带有 IN 运算符的嵌套 SELECT 语句?
- python - 数据框中特定行的总和
- apache-pig - 从猪拉丁文文件中读取元组
- python-3.x - 在轴上添加单位
- versionone - VersionOne REST 查询以获取缺陷的 ToDo 小时数
- algorithm - 如何在二维数组中执行交叉 - 遗传算法
- api - 您可以使用 Xbox API 在 Java 中保持群聊吗?