pam-python 0.1.19__tar.gz → 0.1.21__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 (36) hide show
  1. {pam_python-0.1.19/pam_python.egg-info → pam_python-0.1.21}/PKG-INFO +1 -1
  2. {pam_python-0.1.19 → pam_python-0.1.21}/pam/service.py +17 -4
  3. {pam_python-0.1.19 → pam_python-0.1.21/pam_python.egg-info}/PKG-INFO +1 -1
  4. {pam_python-0.1.19 → pam_python-0.1.21}/setup.py +1 -1
  5. {pam_python-0.1.19 → pam_python-0.1.21}/LICENSE.txt +0 -0
  6. {pam_python-0.1.19 → pam_python-0.1.21}/README.md +0 -0
  7. {pam_python-0.1.19 → pam_python-0.1.21}/pam/__init__.py +0 -0
  8. {pam_python-0.1.19 → pam_python-0.1.21}/pam/api.py +0 -0
  9. {pam_python-0.1.19 → pam_python-0.1.21}/pam/cli.py +0 -0
  10. {pam_python-0.1.19 → pam_python-0.1.21}/pam/interface_task_manager.py +0 -0
  11. {pam_python-0.1.19 → pam_python-0.1.21}/pam/models/__init__.py +0 -0
  12. {pam_python-0.1.19 → pam_python-0.1.21}/pam/models/request_command.py +0 -0
  13. {pam_python-0.1.19 → pam_python-0.1.21}/pam/server.py +0 -0
  14. {pam_python-0.1.19 → pam_python-0.1.21}/pam/sqlite.py +0 -0
  15. {pam_python-0.1.19 → pam_python-0.1.21}/pam/task_manager.py +0 -0
  16. {pam_python-0.1.19 → pam_python-0.1.21}/pam/temp_file_utils.py +0 -0
  17. {pam_python-0.1.19 → pam_python-0.1.21}/pam/templates/buildcmd/pamb +0 -0
  18. {pam_python-0.1.19 → pam_python-0.1.21}/pam/templates/buildcmd/pamb-base.sh +0 -0
  19. {pam_python-0.1.19 → pam_python-0.1.21}/pam/templates/docker/Dockerfile +0 -0
  20. {pam_python-0.1.19 → pam_python-0.1.21}/pam/templates/init/dockerignore.tmpl +0 -0
  21. {pam_python-0.1.19 → pam_python-0.1.21}/pam/templates/init/gitignore.tmpl +0 -0
  22. {pam_python-0.1.19 → pam_python-0.1.21}/pam/templates/init/main.tmpl +0 -0
  23. {pam_python-0.1.19 → pam_python-0.1.21}/pam/templates/init/pylintrc.tmpl +0 -0
  24. {pam_python-0.1.19 → pam_python-0.1.21}/pam/templates/init/run_test.sh +0 -0
  25. {pam_python-0.1.19 → pam_python-0.1.21}/pam/templates/service/functions.tmpl +0 -0
  26. {pam_python-0.1.19 → pam_python-0.1.21}/pam/templates/service/service.test.tmpl +0 -0
  27. {pam_python-0.1.19 → pam_python-0.1.21}/pam/templates/service/service.yaml +0 -0
  28. {pam_python-0.1.19 → pam_python-0.1.21}/pam/templates/service/service_class.tmpl +0 -0
  29. {pam_python-0.1.19 → pam_python-0.1.21}/pam/tester_task.py +0 -0
  30. {pam_python-0.1.19 → pam_python-0.1.21}/pam/utils.py +0 -0
  31. {pam_python-0.1.19 → pam_python-0.1.21}/pam_python.egg-info/SOURCES.txt +0 -0
  32. {pam_python-0.1.19 → pam_python-0.1.21}/pam_python.egg-info/dependency_links.txt +0 -0
  33. {pam_python-0.1.19 → pam_python-0.1.21}/pam_python.egg-info/entry_points.txt +0 -0
  34. {pam_python-0.1.19 → pam_python-0.1.21}/pam_python.egg-info/requires.txt +0 -0
  35. {pam_python-0.1.19 → pam_python-0.1.21}/pam_python.egg-info/top_level.txt +0 -0
  36. {pam_python-0.1.19 → pam_python-0.1.21}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pam-python
3
- Version: 0.1.19
3
+ Version: 0.1.21
4
4
  Summary: Pam Python Library
5
5
  Home-page: https://github.com/heart/pam-python
6
6
  Author: Narongrit Kanhanoi
@@ -22,6 +22,12 @@ class Service:
22
22
  self.request = req
23
23
  self.task_manager = task_manager
24
24
 
25
+ def get_adapter_id(self) -> str:
26
+ """
27
+ Returns the adapter ID for the service based on the request's response API.
28
+ """
29
+ return get_adapter_id(self.request.response_api)
30
+
25
31
  # == REQUEST DATA ===
26
32
  def _request_data(self, page: str = "") -> None:
27
33
  """Requests data for the specified page."""
@@ -57,10 +63,15 @@ class Service:
57
63
 
58
64
  return tmp_file_name
59
65
 
60
- # == UPLOAD REPORT ===
61
- def _upload_report(self, report_name: str, report_json: dict) -> None:
66
+ def _upload_report(self, report_name: str, report_json: dict, tracker_name: str = "") -> str:
62
67
  """
63
68
  Uploads a report in JSON format to a temporary file and notifies the task manager.
69
+ Args:
70
+ report_name (str): Name of the report.
71
+ report_json (dict): The report content as a dictionary.
72
+ tracker_name (str, optional): Tracker name to include in the report. Defaults to empty string.
73
+ Returns:
74
+ str: Path to the uploaded report CSV file.
64
75
  """
65
76
  if not isinstance(report_json, dict):
66
77
  raise ValueError("report_json must be a dictionary")
@@ -75,6 +86,7 @@ class Service:
75
86
  formatted_report_name = f"data_{report_name}_no_index"
76
87
  df = pd.DataFrame({
77
88
  'customer': [adapter_id],
89
+ '_tracker_name': [tracker_name],
78
90
  formatted_report_name: [json_string]
79
91
  })
80
92
 
@@ -97,7 +109,8 @@ class Service:
97
109
 
98
110
  return report_csv_path
99
111
 
100
- def _request_sqlite(self, file_name: str = "", is_shared: bool = False) -> str | None:
112
+
113
+ def _request_sqlite(self, file_name: str = "", is_shared: bool = False) -> str:
101
114
  """Requests last sqlite file that this plugin has uploaded from the last time.
102
115
 
103
116
  Returns:
@@ -129,7 +142,7 @@ class Service:
129
142
  return output_path
130
143
  else:
131
144
  log(f"{self.request.service_name}: Failed to download SQLite file.")
132
- return None
145
+ return output_path
133
146
 
134
147
 
135
148
  def _upload_sqlite(self, file_name: str = "", is_shared: bool = False, sqlite_file: str = "") -> str:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pam-python
3
- Version: 0.1.19
3
+ Version: 0.1.21
4
4
  Summary: Pam Python Library
5
5
  Home-page: https://github.com/heart/pam-python
6
6
  Author: Narongrit Kanhanoi
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="pam-python",
5
- version="0.1.19",
5
+ version="0.1.21",
6
6
  author="Narongrit Kanhanoi",
7
7
  author_email="narongrit@pams.ai",
8
8
  description="Pam Python Library",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes