smartpush 1.0.2.8__py3-none-any.whl → 1.0.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- smartpush/export/basic/ExcelExportChecker.py +6 -3
- smartpush/felix_test.py +11 -0
- smartpush/get_jira_info.py +54 -44
- {smartpush-1.0.2.8.dist-info → smartpush-1.0.3.dist-info}/METADATA +1 -6
- smartpush-1.0.3.dist-info/RECORD +10 -0
- {smartpush-1.0.2.8.dist-info → smartpush-1.0.3.dist-info}/WHEEL +1 -1
- smartpush-1.0.2.8.dist-info/RECORD +0 -9
- {smartpush-1.0.2.8.dist-info → smartpush-1.0.3.dist-info}/top_level.txt +0 -0
@@ -3,9 +3,11 @@ from io import BytesIO
|
|
3
3
|
import pandas as pd
|
4
4
|
import numpy as np
|
5
5
|
from requests import request
|
6
|
+
"""
|
7
|
+
用于excel校验
|
8
|
+
"""
|
6
9
|
|
7
|
-
|
8
|
-
def read_excel_from_oss(method, url):
|
10
|
+
def read_excel_from_oss(method="get", url=""):
|
9
11
|
"""读取oss的excel内容并写入到本地csv"""
|
10
12
|
try:
|
11
13
|
result = request(method=method, url=url)
|
@@ -72,7 +74,7 @@ def check_excel(actual, expected):
|
|
72
74
|
"""
|
73
75
|
try:
|
74
76
|
if actual == expected:
|
75
|
-
return True
|
77
|
+
return True, ["完全匹配"]
|
76
78
|
else:
|
77
79
|
errors = []
|
78
80
|
# 断言1:校验行数
|
@@ -99,6 +101,7 @@ def check_excel(actual, expected):
|
|
99
101
|
return False, errors
|
100
102
|
except Exception as e:
|
101
103
|
print(f"对比excel:{e}")
|
104
|
+
return False, [e]
|
102
105
|
|
103
106
|
|
104
107
|
def del_temp_file(file_name=""):
|
smartpush/felix_test.py
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
import requests
|
2
|
+
|
3
|
+
from smartpush.export.basic import ExcelExportChecker
|
4
|
+
|
5
|
+
if __name__ == '__main__':
|
6
|
+
|
7
|
+
ossurl = "https://sl-smartfile.oss-ap-southeast-1.aliyuncs.com/material_ec2/2025-01-16/8556e34c8d4d45f0bb2d42dc8871a90b/%E8%A1%A8%E5%8D%95%E4%BB%BB%E5%8A%A1%E6%95%B0%E6%8D%AE%E6%A6%82%E8%A7%88.xlsx"
|
8
|
+
excelOss = ExcelExportChecker.read_excel_from_oss(url=ossurl)
|
9
|
+
excelList = ExcelExportChecker.read_excel_and_write_to_list(excel_data=excelOss)
|
10
|
+
print(excelList)
|
11
|
+
|
smartpush/get_jira_info.py
CHANGED
@@ -1,64 +1,74 @@
|
|
1
1
|
from jira import JIRA
|
2
|
+
import re
|
2
3
|
|
4
|
+
def get_jira_info(jira_user, jira_api_key):
|
5
|
+
"""
|
6
|
+
获取jira对象
|
7
|
+
@return:
|
8
|
+
"""
|
9
|
+
# api_key = "ATATT3xFfGF0JPzR4t2coi53yM2eKZfUy5eXJSbZHqWmbX9PzStyaNCM2lEjn_uP5TkOl_p4pqZCICH5ZqdWkdmfSxJmTsn6AOcU7I3vVWnDl0i1PRktMdSSqWs1yg1JVSVtlGCrMKfZaztsJOjAQsp3Jd6hHdKpB4A4nVBBkmB7sDOpsNbTNeY=910B5249"
|
3
10
|
|
4
|
-
|
5
|
-
|
6
|
-
#
|
11
|
+
# Jira 服务器的 URL
|
12
|
+
jira_url = "https://shopline.atlassian.net/"
|
13
|
+
# # Jira API 密钥
|
14
|
+
# jira_api_key = api_key
|
15
|
+
# # Jira 用户名
|
16
|
+
# jira_user = "lu.lu@shopline.com"
|
17
|
+
|
18
|
+
# 连接到 Jira 服务器
|
19
|
+
jira = JIRA(server=jira_url, basic_auth=(jira_user, jira_api_key))
|
20
|
+
return jira
|
21
|
+
|
22
|
+
|
23
|
+
def get_jira_prodcut(jira, project_key):
|
24
|
+
project = jira.project(str(project_key))
|
25
|
+
print(f"Project: {project.key} - {project.name}")
|
26
|
+
return project
|
27
|
+
|
28
|
+
|
29
|
+
def get_custom_fields(jira_obj, project_key='10559'):
|
30
|
+
"""
|
31
|
+
查询指定项目jira中的自定义字段,smartpush项目是 10559
|
32
|
+
@param project_id: 项目id
|
33
|
+
@param jira_obj: 对象
|
34
|
+
@return:
|
35
|
+
"""
|
36
|
+
all_fields = jira_obj.fields()
|
37
|
+
# print("all_fields:",all_fields)
|
7
38
|
custom_fields = {}
|
8
39
|
for field in all_fields:
|
9
40
|
try:
|
10
|
-
# print(field)
|
11
41
|
if field.get('custom'):
|
12
|
-
if field['scope']['project']['id'] ==
|
42
|
+
if field['scope']['project']['id'] == str(project_key):
|
13
43
|
custom_fields[field['id']] = field['name']
|
14
44
|
except:
|
15
45
|
continue
|
16
|
-
print(custom_fields)
|
46
|
+
print("custom_fields:", custom_fields)
|
17
47
|
return custom_fields
|
18
48
|
|
19
49
|
|
20
|
-
|
21
|
-
api_key = "ATATT3xFfGF0YeIApQYdm4c671OUkhg5ggVISNgIb0D1Iqpd2dwwunzff98Pc5VQjb74ZN997uXvvxi6LpmNGJx1kW1BLh5AaudMj5RuWTe6uozsGqGpx_QkySeU2HF-JB37kkza9PREOpOSbiDFZxrI0eqYPV9Fe-bJP0RM16V_GSyDPib0wmw=FE3DE2B1"
|
22
|
-
|
23
|
-
# Jira 服务器的 URL
|
24
|
-
jira_url = "https://shopline.atlassian.net/"
|
25
|
-
# Jira API 密钥
|
26
|
-
jira_api_key = api_key
|
27
|
-
# Jira 用户名
|
28
|
-
jira_user = "lu.lu@shopline.com"
|
29
|
-
|
30
|
-
# 连接到 Jira 服务器
|
31
|
-
jira = JIRA(server=jira_url, basic_auth=(jira_user, jira_api_key))
|
32
|
-
|
33
|
-
# 获取一个项目的信息
|
34
|
-
project_key = 10559 # 替换为你想要获取的项目的 key
|
35
|
-
project = jira.project(project_key)
|
36
|
-
print(f"Project: {project.key} - {project.name}")
|
37
|
-
|
38
|
-
all_fields = jira.fields()
|
39
|
-
# print(all_fields)
|
40
|
-
|
50
|
+
def get_custom_fields_map(jira, project_key=10559):
|
41
51
|
# 获取项目的问题
|
42
52
|
issues = jira.search_issues(f"project={project_key}")
|
43
53
|
issue = jira.issue(issues[0])
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
# print("Assignee:", issue.fields.assignee.displayName if issue.fields.assignee else "Unassigned")
|
48
|
-
# print("Reporter:", issue.fields.reporter.displayName)
|
49
|
-
# print("Status:", issue.fields.status.name)
|
50
|
-
# print("Priority:", issue.fields.priority.name)
|
51
|
-
# print("Created:", issue.fields.created)
|
52
|
-
# print("Updated:", issue.fields.updated)
|
53
|
-
# print("Due Date:", issue.fields.duedate)
|
54
|
-
# print("Labels:", issue.fields.labels)
|
55
|
-
# print("Components:", [component.name for component in issue.fields.components])
|
56
|
-
# print(issue.fields.__dict__.items())
|
57
|
-
custom_fields = get_custom_fields(jira)
|
54
|
+
custom_fields = get_custom_fields(jira, project_key)
|
55
|
+
print(custom_fields)
|
56
|
+
fields_map = {}
|
58
57
|
for field_name, field_value in issue.fields.__dict__.items():
|
59
58
|
try:
|
60
|
-
|
61
|
-
|
62
|
-
|
59
|
+
if field_name.startswith("customfield_"):
|
60
|
+
fields_map[custom_fields[field_name]] = field_value
|
61
|
+
print(f"Custom Field ID: {field_name}, NAME:{custom_fields[field_name]}, Value: {field_value}")
|
62
|
+
else:
|
63
|
+
fields_map[field_name] = field_value
|
64
|
+
print(f"ID: {field_name},Value: {field_value}")
|
63
65
|
except:
|
66
|
+
# raise
|
64
67
|
continue
|
68
|
+
print('fields_map:',fields_map)
|
69
|
+
if __name__ == '__main__':
|
70
|
+
api_key = "ATATT3xFfGF0JPzR4t2coi53yM2eKZfUy5eXJSbZHqWmbX9PzStyaNCM2lEjn_uP5TkOl_p4pqZCICH5ZqdWkdmfSxJmTsn6AOcU7I3vVWnDl0i1PRktMdSSqWs1yg1JVSVtlGCrMKfZaztsJOjAQsp3Jd6hHdKpB4A4nVBBkmB7sDOpsNbTNeY=910B5249"
|
71
|
+
# Jira 用户名
|
72
|
+
jira_user = "lu.lu@shopline.com"
|
73
|
+
jira = get_jira_info(jira_user, api_key)
|
74
|
+
get_custom_fields_map(jira)
|
@@ -0,0 +1,10 @@
|
|
1
|
+
smartpush/__init__.py,sha256=XJrl1vhGATHSeSVqKmPXxYqxyseriUpvY5tLIXir3EE,24
|
2
|
+
smartpush/felix_test.py,sha256=I7DkMnqRUa48ALyawoJtPh74zRR86OO3oRnkBi9qJRQ,476
|
3
|
+
smartpush/get_jira_info.py,sha256=dmCwkKa94xwyE2hegE1KBI3cV_LbrJ67P9osORUGPt4,2633
|
4
|
+
smartpush/export/__init__.py,sha256=D9GbWcmwnetEndFDty5XbVienFK1WjqV2yYcQp3CM84,99
|
5
|
+
smartpush/export/basic/ExcelExportChecker.py,sha256=3brXFECXhTMuVnB-CLnaLBK5CZPW2TuooL0n_B6iigg,4374
|
6
|
+
smartpush/export/basic/__init__.py,sha256=6tcrS-2NSlsJo-UwEsnGUmwCf7jgOsh_UEbM0FD-gYE,70
|
7
|
+
smartpush-1.0.3.dist-info/METADATA,sha256=TgyZqa2PcOcQ3t1sG7qiGoGW10kwhoSji2z9mQ76pZM,145
|
8
|
+
smartpush-1.0.3.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
9
|
+
smartpush-1.0.3.dist-info/top_level.txt,sha256=5_CXqu08EfbPaKLjuSAOAqCmGU6shiatwDU_ViBGCmg,10
|
10
|
+
smartpush-1.0.3.dist-info/RECORD,,
|
@@ -1,9 +0,0 @@
|
|
1
|
-
smartpush/__init__.py,sha256=XJrl1vhGATHSeSVqKmPXxYqxyseriUpvY5tLIXir3EE,24
|
2
|
-
smartpush/get_jira_info.py,sha256=zXp5OB9fVY5e0RbYcqlcq3ClqwLBAEvAVPZ1A_PrdMg,2416
|
3
|
-
smartpush/export/__init__.py,sha256=D9GbWcmwnetEndFDty5XbVienFK1WjqV2yYcQp3CM84,99
|
4
|
-
smartpush/export/basic/ExcelExportChecker.py,sha256=tN4WG5WeP_T3zmeKMTyIVBBUGdzLcQZKeXila5rqb-8,4296
|
5
|
-
smartpush/export/basic/__init__.py,sha256=6tcrS-2NSlsJo-UwEsnGUmwCf7jgOsh_UEbM0FD-gYE,70
|
6
|
-
smartpush-1.0.2.8.dist-info/METADATA,sha256=FfjUIvI_50v9HSZ2ccW1oA2ega5WZAsSeAR-CyDzlVg,210
|
7
|
-
smartpush-1.0.2.8.dist-info/WHEEL,sha256=OqRkF0eY5GHssMorFjlbTIq072vpHpF60fIQA6lS9xA,92
|
8
|
-
smartpush-1.0.2.8.dist-info/top_level.txt,sha256=5_CXqu08EfbPaKLjuSAOAqCmGU6shiatwDU_ViBGCmg,10
|
9
|
-
smartpush-1.0.2.8.dist-info/RECORD,,
|
File without changes
|