t-bug-catcher 0.6.7__tar.gz → 0.6.10__tar.gz

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.
Files changed (26) hide show
  1. {t_bug_catcher-0.6.7 → t_bug_catcher-0.6.10}/PKG-INFO +2 -2
  2. {t_bug_catcher-0.6.7 → t_bug_catcher-0.6.10}/setup.cfg +1 -1
  3. {t_bug_catcher-0.6.7 → t_bug_catcher-0.6.10}/setup.py +1 -1
  4. {t_bug_catcher-0.6.7 → t_bug_catcher-0.6.10}/t_bug_catcher/__init__.py +1 -1
  5. {t_bug_catcher-0.6.7 → t_bug_catcher-0.6.10}/t_bug_catcher/bug_catcher.py +3 -0
  6. {t_bug_catcher-0.6.7 → t_bug_catcher-0.6.10}/t_bug_catcher/config.py +1 -1
  7. {t_bug_catcher-0.6.7 → t_bug_catcher-0.6.10}/t_bug_catcher/jira.py +25 -5
  8. {t_bug_catcher-0.6.7 → t_bug_catcher-0.6.10}/t_bug_catcher.egg-info/PKG-INFO +2 -2
  9. {t_bug_catcher-0.6.7 → t_bug_catcher-0.6.10}/MANIFEST.in +0 -0
  10. {t_bug_catcher-0.6.7 → t_bug_catcher-0.6.10}/README.rst +0 -0
  11. {t_bug_catcher-0.6.7 → t_bug_catcher-0.6.10}/pyproject.toml +0 -0
  12. {t_bug_catcher-0.6.7 → t_bug_catcher-0.6.10}/requirements.txt +0 -0
  13. {t_bug_catcher-0.6.7 → t_bug_catcher-0.6.10}/t_bug_catcher/bug_snag.py +0 -0
  14. {t_bug_catcher-0.6.7 → t_bug_catcher-0.6.10}/t_bug_catcher/exceptions.py +0 -0
  15. {t_bug_catcher-0.6.7 → t_bug_catcher-0.6.10}/t_bug_catcher/resources/whispers_config.yml +0 -0
  16. {t_bug_catcher-0.6.7 → t_bug_catcher-0.6.10}/t_bug_catcher/stack_saver.py +0 -0
  17. {t_bug_catcher-0.6.7 → t_bug_catcher-0.6.10}/t_bug_catcher/utils/__init__.py +0 -0
  18. {t_bug_catcher-0.6.7 → t_bug_catcher-0.6.10}/t_bug_catcher/utils/common.py +0 -0
  19. {t_bug_catcher-0.6.7 → t_bug_catcher-0.6.10}/t_bug_catcher/utils/logger.py +0 -0
  20. {t_bug_catcher-0.6.7 → t_bug_catcher-0.6.10}/t_bug_catcher/workitems.py +0 -0
  21. {t_bug_catcher-0.6.7 → t_bug_catcher-0.6.10}/t_bug_catcher.egg-info/SOURCES.txt +0 -0
  22. {t_bug_catcher-0.6.7 → t_bug_catcher-0.6.10}/t_bug_catcher.egg-info/dependency_links.txt +0 -0
  23. {t_bug_catcher-0.6.7 → t_bug_catcher-0.6.10}/t_bug_catcher.egg-info/not-zip-safe +0 -0
  24. {t_bug_catcher-0.6.7 → t_bug_catcher-0.6.10}/t_bug_catcher.egg-info/requires.txt +0 -0
  25. {t_bug_catcher-0.6.7 → t_bug_catcher-0.6.10}/t_bug_catcher.egg-info/top_level.txt +0 -0
  26. {t_bug_catcher-0.6.7 → t_bug_catcher-0.6.10}/tests/test_t_bug_catcher.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: t_bug_catcher
3
- Version: 0.6.7
3
+ Version: 0.6.10
4
4
  Summary: Bug catcher
5
5
  Home-page: https://www.thoughtful.ai/
6
6
  Author: Thoughtful
@@ -1,5 +1,5 @@
1
1
  [bumpversion]
2
- current_version = 0.6.7
2
+ current_version = 0.6.10
3
3
  commit = True
4
4
  tag = False
5
5
 
@@ -26,7 +26,7 @@ setup(
26
26
  packages=find_packages(include=["t_bug_catcher", "t_bug_catcher.*"]),
27
27
  test_suite="tests",
28
28
  url="https://www.thoughtful.ai/",
29
- version="0.6.7",
29
+ version="0.6.10",
30
30
  zip_safe=False,
31
31
  install_requires=install_requirements,
32
32
  include_package_data=True,
@@ -3,7 +3,7 @@
3
3
  __author__ = """Thoughtful"""
4
4
  __email__ = "support@thoughtful.ai"
5
5
  # fmt: off
6
- __version__ = '0.6.7'
6
+ __version__ = '0.6.10'
7
7
  # fmt: on
8
8
 
9
9
  from .bug_catcher import (
@@ -30,6 +30,7 @@ class Configurator:
30
30
  api_token: str,
31
31
  project_key: str,
32
32
  webhook_url: Optional[str] = None,
33
+ webhook_secret: Optional[str] = None,
33
34
  default_assignee: Optional[str] = None,
34
35
  ):
35
36
  """Configures the JiraPoster and BugSnag classes.
@@ -39,6 +40,7 @@ class Configurator:
39
40
  api_token (str): The API token for the Jira account.
40
41
  project_key (str): The key of the Jira project.
41
42
  webhook_url (str, optional): The webhook URL for the Jira project. Defaults to None.
43
+ webhook_secret (str, optional): The webhook secret for the Jira project. Defaults to None.
42
44
  default_assignee (str, optional): The default assignee for the Jira project. Defaults to None.
43
45
 
44
46
  Returns:
@@ -49,6 +51,7 @@ class Configurator:
49
51
  api_token=api_token,
50
52
  project_key=project_key,
51
53
  webhook_url=webhook_url,
54
+ webhook_secret=webhook_secret,
52
55
  default_assignee=default_assignee,
53
56
  )
54
57
 
@@ -28,7 +28,7 @@ class Config:
28
28
  LOW: str = "4"
29
29
  LOWEST: str = "5"
30
30
 
31
- SUPPORT_BOARD = "AB"
31
+ SUPPORT_BOARD = "SST"
32
32
  BC_BOARD = "BC"
33
33
 
34
34
  KEYS_TO_REMOVE = ["credential", "password"]
@@ -54,6 +54,7 @@ class Jira:
54
54
  self._issue_types = {}
55
55
  self._project_key = None
56
56
  self._webhook_url = None
57
+ self._webhook_secret = None
57
58
  self._auth = None
58
59
  self._default_assignee = None
59
60
  self._build_info: Optional[dict] = None
@@ -99,6 +100,7 @@ class Jira:
99
100
  api_token: str,
100
101
  project_key: str,
101
102
  webhook_url: Optional[str] = None,
103
+ webhook_secret: Optional[str] = None,
102
104
  default_assignee: Optional[str] = None,
103
105
  ) -> bool:
104
106
  """Sets the webhook URL for the Jira project.
@@ -108,6 +110,7 @@ class Jira:
108
110
  api_token (str): The API token for the Jira account.
109
111
  project_key (str): The key of the Jira project.
110
112
  webhook_url (str): The webhook URL for the Jira project.
113
+ webhook_secret (str, optional): The webhook secret for the Jira project. Defaults to None.
111
114
  default_assignee (str, optional): The default assignee for the Jira project. Defaults to None.
112
115
 
113
116
  Returns:
@@ -120,6 +123,7 @@ class Jira:
120
123
  if not webhook_url:
121
124
  logger.warning("No JIRA webhook URL provided. All issues will be posted to backlog.")
122
125
  self._webhook_url = webhook_url
126
+ self._webhook_secret = webhook_secret
123
127
  self._auth = self._authenticate(login, api_token)
124
128
  try:
125
129
  self.get_current_user()
@@ -265,10 +269,13 @@ class Jira:
265
269
  None
266
270
  """
267
271
  payload = json.dumps({"issues": [ticket_id]})
272
+ headers = {"Content-type": "application/json"}
273
+ if self._webhook_secret:
274
+ headers["X-Automation-Webhook-Token"] = self._webhook_secret
268
275
  requests.request(
269
276
  "POST",
270
277
  url=self._webhook_url,
271
- headers={"Content-type": "application/json"},
278
+ headers=headers,
272
279
  data=payload,
273
280
  )
274
281
 
@@ -1770,19 +1777,32 @@ class Jira:
1770
1777
  return response[0]["accountId"]
1771
1778
 
1772
1779
  @staticmethod
1773
- def sanitize_summary(exception: Union[Exception, str]) -> str:
1780
+ def sanitize_summary(exception: Exception) -> str:
1774
1781
  """Remove locators from the exception.
1775
1782
 
1776
1783
  Args:
1777
- exception (Union[Exception, str]): The exception to be cleaned.
1784
+ exception (Exception): The exception to be cleaned.
1778
1785
 
1779
1786
  Returns:
1780
1787
  str: The cleaned exception string.
1781
1788
  """
1782
- message = re.sub("<([a-z]+)(?![^>]*\/>)[^>]*>", r"<\1>", str(exception))
1789
+ try:
1790
+ exception_str = str(exception)
1791
+ except Exception as e:
1792
+ logger.warning(f"Failed to convert exception to string due to: {e}")
1793
+ try:
1794
+ tb_lines = traceback.format_exception(type(exception), exception, exception.__traceback__)
1795
+ exception_str = tb_lines[-1].strip()
1796
+ except Exception as e:
1797
+ logger.warning(f"Failed to convert exception to string due to: {e}")
1798
+ return exception.__class__.__name__
1799
+
1800
+ message = re.sub("<([a-z]+)(?![^>]*\/>)[^>]*>", r"<\1>", exception_str)
1783
1801
  message = re.sub(">([^<]+)<\/", ">...</", message)
1802
+
1784
1803
  if "selenium" not in exception.__class__.__name__.lower() and not isinstance(exception, AssertionError):
1785
- return str(message)
1804
+ return message
1805
+
1786
1806
  return re.sub(r"\'(.+)\'", "'...'", message)
1787
1807
 
1788
1808
  def __create_summary(
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: t_bug_catcher
3
- Version: 0.6.7
3
+ Version: 0.6.10
4
4
  Summary: Bug catcher
5
5
  Home-page: https://www.thoughtful.ai/
6
6
  Author: Thoughtful
File without changes