How can I grep a table from Confluence to Jira through Python?

Keerthi Pandrapragada
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 4, 2024


How can I grep a table with heading Killed tests into Jira through Python?

I have been trying it like this, but this does'nt work.

def grep_killed_tests_table(jREG_REF):
jtableinfo = []
response = requests.get(jREG_REF, verify=False)
content = response.text
tree = html.fromstring(content)
print(f"tree: {tree}")
xpath_exp = "//table[.//th[contains(., 'Killed tests')]]"
jkilled_tests_table = tree.xpath(xpath_exp)
print(f"jkilledteststable {jkilled_tests_table}")
if jkilled_tests_table:
jtable_data = []
for row in jkilled_tests_table[0].xpath(".//tr"):
row_data = [cell.text_content().strip() for cell in row.xpath(".//td|.//th")]
if row_data:
for row in jtable_data:
return jtableinfo
except requests.exceptions.RequestException as e:
print(f"{script_error} Not found {e}")
jkilled_tests_table = grep_killed_tests_table(jREG)

I want it to be updated into Jira from Confluence . Could you help me out with this?


Warm Regards,


0 answers

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events