pam-python 0.1.6__tar.gz → 0.1.8__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 (34) hide show
  1. {pam_python-0.1.6/pam_python.egg-info → pam_python-0.1.8}/PKG-INFO +1 -1
  2. {pam_python-0.1.6 → pam_python-0.1.8}/pam/task_manager.py +48 -5
  3. {pam_python-0.1.6 → pam_python-0.1.8/pam_python.egg-info}/PKG-INFO +1 -1
  4. {pam_python-0.1.6 → pam_python-0.1.8}/setup.py +1 -1
  5. {pam_python-0.1.6 → pam_python-0.1.8}/LICENSE.txt +0 -0
  6. {pam_python-0.1.6 → pam_python-0.1.8}/README.md +0 -0
  7. {pam_python-0.1.6 → pam_python-0.1.8}/pam/__init__.py +0 -0
  8. {pam_python-0.1.6 → pam_python-0.1.8}/pam/api.py +0 -0
  9. {pam_python-0.1.6 → pam_python-0.1.8}/pam/cli.py +0 -0
  10. {pam_python-0.1.6 → pam_python-0.1.8}/pam/interface_task_manager.py +0 -0
  11. {pam_python-0.1.6 → pam_python-0.1.8}/pam/models/__init__.py +0 -0
  12. {pam_python-0.1.6 → pam_python-0.1.8}/pam/models/request_command.py +0 -0
  13. {pam_python-0.1.6 → pam_python-0.1.8}/pam/server.py +0 -0
  14. {pam_python-0.1.6 → pam_python-0.1.8}/pam/service.py +0 -0
  15. {pam_python-0.1.6 → pam_python-0.1.8}/pam/temp_file_utils.py +0 -0
  16. {pam_python-0.1.6 → pam_python-0.1.8}/pam/templates/buildcmd/pamb +0 -0
  17. {pam_python-0.1.6 → pam_python-0.1.8}/pam/templates/buildcmd/pamb-base.sh +0 -0
  18. {pam_python-0.1.6 → pam_python-0.1.8}/pam/templates/docker/Dockerfile +0 -0
  19. {pam_python-0.1.6 → pam_python-0.1.8}/pam/templates/init/dockerignore.tmpl +0 -0
  20. {pam_python-0.1.6 → pam_python-0.1.8}/pam/templates/init/gitignore.tmpl +0 -0
  21. {pam_python-0.1.6 → pam_python-0.1.8}/pam/templates/init/main.tmpl +0 -0
  22. {pam_python-0.1.6 → pam_python-0.1.8}/pam/templates/init/pylintrc.tmpl +0 -0
  23. {pam_python-0.1.6 → pam_python-0.1.8}/pam/templates/service/functions.tmpl +0 -0
  24. {pam_python-0.1.6 → pam_python-0.1.8}/pam/templates/service/service.test.tmpl +0 -0
  25. {pam_python-0.1.6 → pam_python-0.1.8}/pam/templates/service/service.yaml +0 -0
  26. {pam_python-0.1.6 → pam_python-0.1.8}/pam/templates/service/service_class.tmpl +0 -0
  27. {pam_python-0.1.6 → pam_python-0.1.8}/pam/tester_task.py +0 -0
  28. {pam_python-0.1.6 → pam_python-0.1.8}/pam/utils.py +0 -0
  29. {pam_python-0.1.6 → pam_python-0.1.8}/pam_python.egg-info/SOURCES.txt +0 -0
  30. {pam_python-0.1.6 → pam_python-0.1.8}/pam_python.egg-info/dependency_links.txt +0 -0
  31. {pam_python-0.1.6 → pam_python-0.1.8}/pam_python.egg-info/entry_points.txt +0 -0
  32. {pam_python-0.1.6 → pam_python-0.1.8}/pam_python.egg-info/requires.txt +0 -0
  33. {pam_python-0.1.6 → pam_python-0.1.8}/pam_python.egg-info/top_level.txt +0 -0
  34. {pam_python-0.1.6 → pam_python-0.1.8}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: pam-python
3
- Version: 0.1.6
3
+ Version: 0.1.8
4
4
  Summary: Pam Python Library
5
5
  Home-page: https://github.com/heart/pam-python
6
6
  Author: Narongrit Kanhanoi
@@ -129,31 +129,74 @@ class TaskManager(ITaskManager):
129
129
  def service_request_data(self, service: Service, page):
130
130
  """
131
131
  Makes an asynchronous request for data from a service.
132
+ Logs the response without blocking the main thread.
132
133
  """
133
134
  endpoint = service.request.data_api
134
135
  token = service.request.token
135
136
  json_data = {"page": page, "token": token}
136
137
 
138
+ def handle_response(response):
139
+ """Logs the response from the API."""
140
+ try:
141
+ response_data = response.json()
142
+ except ValueError:
143
+ response_data = response.text
144
+ log(f"Response from {endpoint}: {response_data}")
145
+
146
+ def api_call_wrapper():
147
+ """Wrapper for the API call to handle response."""
148
+ response = self.api.http_post(endpoint, json_data)
149
+ handle_response(response)
150
+
137
151
  log(f"Requesting Data from: {endpoint}, page: {page}, token={token}")
138
- http_thread = threading.Thread(target=self.api.http_post, args=(endpoint, json_data))
152
+ http_thread = threading.Thread(target=api_call_wrapper)
139
153
  http_thread.start()
140
154
 
155
+
141
156
  def service_upload_result(self, service: Service, file_path):
142
157
  """
143
- Uploads a result file asynchronously.
158
+ Uploads a result file asynchronously and logs the response.
144
159
  """
145
160
  endpoint = service.request.response_api
161
+
162
+ def handle_upload_response(response):
163
+ """Logs the response after the upload completes."""
164
+ try:
165
+ response_data = response.json()
166
+ except ValueError:
167
+ response_data = response.text
168
+ log(f"Response from upload to {endpoint}: {response_data}")
169
+
170
+ def upload_wrapper():
171
+ """Wrapper for the upload to handle response logging."""
172
+ response = self.api.http_upload(endpoint, file_path)
173
+ handle_upload_response(response)
174
+
146
175
  log(f"Uploading Result to: {endpoint}")
147
- http_thread = threading.Thread(target=self.api.http_upload, args=(endpoint, file_path))
176
+ http_thread = threading.Thread(target=upload_wrapper)
148
177
  http_thread.start()
149
178
 
150
179
  def service_upload_report(self, service: Service, file_path):
151
180
  """
152
- Uploads a report file asynchronously.
181
+ Uploads a report file asynchronously and logs the response.
153
182
  """
154
183
  endpoint = service.request.response_api
184
+
185
+ def handle_report_response(response):
186
+ """Logs the response after the report upload completes."""
187
+ try:
188
+ response_data = response.json()
189
+ except ValueError:
190
+ response_data = response.text
191
+ log(f"Response from report upload to {endpoint}: {response_data}")
192
+
193
+ def upload_wrapper():
194
+ """Wrapper for the report upload to handle response logging."""
195
+ response = self.api.http_upload(endpoint, file_path)
196
+ handle_report_response(response)
197
+
155
198
  log(f"Uploading Report to: {endpoint}")
156
- http_thread = threading.Thread(target=self.api.http_upload, args=(endpoint, file_path))
199
+ http_thread = threading.Thread(target=upload_wrapper)
157
200
  http_thread.start()
158
201
 
159
202
  def service_exit(self, service: Service):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: pam-python
3
- Version: 0.1.6
3
+ Version: 0.1.8
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.6",
5
+ version="0.1.8",
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