PKDevTools 0.13.20250218.236__tar.gz → 0.13.20250221.238__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. pkdevtools-0.13.20250221.238/PKDevTools/classes/__init__.py +1 -0
  2. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/PKDevTools/classes/pubsub/publisher.py +5 -0
  3. pkdevtools-0.13.20250221.238/PKDevTools/classes/pubsub/subscriber.py +87 -0
  4. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/PKDevTools.egg-info/PKG-INFO +2 -2
  5. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/PKG-INFO +2 -2
  6. pkdevtools-0.13.20250218.236/PKDevTools/classes/__init__.py +0 -1
  7. pkdevtools-0.13.20250218.236/PKDevTools/classes/pubsub/subscriber.py +0 -54
  8. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/LICENSE +0 -0
  9. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/PKDevTools/LICENSE.txt +0 -0
  10. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/PKDevTools/README.txt +0 -0
  11. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/PKDevTools/__init__.py +0 -0
  12. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/PKDevTools/classes/Archiver.py +0 -0
  13. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/PKDevTools/classes/ColorText.py +0 -0
  14. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/PKDevTools/classes/Committer.py +0 -0
  15. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/PKDevTools/classes/CookieHelper.py +0 -0
  16. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/PKDevTools/classes/DBManager.py +0 -0
  17. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/PKDevTools/classes/Environment.py +0 -0
  18. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/PKDevTools/classes/Fetcher.py +0 -0
  19. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/PKDevTools/classes/FunctionTimeouts.py +0 -0
  20. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/PKDevTools/classes/GmailReader.py +0 -0
  21. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/PKDevTools/classes/MarketHours.py +0 -0
  22. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/PKDevTools/classes/MenuOptions.py +0 -0
  23. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/PKDevTools/classes/NSEMarketStatus.py +0 -0
  24. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/PKDevTools/classes/OutputControls.py +0 -0
  25. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/PKDevTools/classes/PKDateUtilities.py +0 -0
  26. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/PKDevTools/classes/PKGitFolderDownloader.py +0 -0
  27. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/PKDevTools/classes/PKJoinableQueue.py +0 -0
  28. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/PKDevTools/classes/PKMultiProcessorClient.py +0 -0
  29. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/PKDevTools/classes/PKPickler.py +0 -0
  30. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/PKDevTools/classes/PKTimer.py +0 -0
  31. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/PKDevTools/classes/Pikey.py +0 -0
  32. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/PKDevTools/classes/Singleton.py +0 -0
  33. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/PKDevTools/classes/SuppressOutput.py +0 -0
  34. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/PKDevTools/classes/System.py +0 -0
  35. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/PKDevTools/classes/Telegram.py +0 -0
  36. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/PKDevTools/classes/UserSubscriptions.py +0 -0
  37. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/PKDevTools/classes/Utils.py +0 -0
  38. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/PKDevTools/classes/WorkflowManager.py +0 -0
  39. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/PKDevTools/classes/githubutilities.py +0 -0
  40. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/PKDevTools/classes/log.py +0 -0
  41. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/PKDevTools/classes/multiprocessing_logging.py +0 -0
  42. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/PKDevTools/classes/pubsub/__init__.py +0 -0
  43. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/PKDevTools/classes/pubsub/events.py +0 -0
  44. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/PKDevTools/classes/squash.py +0 -0
  45. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/PKDevTools/classes/updater.py +0 -0
  46. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/PKDevTools/release.md +0 -0
  47. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/PKDevTools/requirements.txt +0 -0
  48. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/PKDevTools.egg-info/SOURCES.txt +0 -0
  49. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/PKDevTools.egg-info/dependency_links.txt +0 -0
  50. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/PKDevTools.egg-info/entry_points.txt +0 -0
  51. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/PKDevTools.egg-info/not-zip-safe +0 -0
  52. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/PKDevTools.egg-info/requires.txt +0 -0
  53. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/PKDevTools.egg-info/top_level.txt +0 -0
  54. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/README.md +0 -0
  55. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/setup.cfg +0 -0
  56. {pkdevtools-0.13.20250218.236 → pkdevtools-0.13.20250221.238}/setup.py +0 -0
@@ -0,0 +1 @@
1
+ VERSION='0.13.20250221.238'
@@ -29,3 +29,8 @@ class PKUserService:
29
29
  print(f"[UserService] Notifying for scanner: {scannerID} with notification: {notification}")
30
30
  # Publish the event
31
31
  globalEventsSignal.send(self, scannerID=scannerID,notification=notification)
32
+
33
+ def send_event(self, event_name, event_params=None):
34
+ """Send a custom event to Google Analytics."""
35
+ # Publish the event
36
+ globalEventsSignal.send(self, eventType="ga",event_name=event_name,event_params=event_params)
@@ -0,0 +1,87 @@
1
+ """
2
+ The MIT License (MIT)
3
+
4
+ Copyright (c) 2023 pkjmesra
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
23
+
24
+ """
25
+ import uuid
26
+ import requests
27
+ from PKDevTools.classes.pubsub.events import globalEventsSignal
28
+ from PKDevTools.classes.DBManager import DBManager
29
+ from PKDevTools.classes.Telegram import send_message
30
+
31
+ from PKDevTools.classes.Singleton import SingletonType, SingletonMixin
32
+
33
+ class PKNotificationService(SingletonMixin, metaclass=SingletonType):
34
+ def __init__(self):
35
+ super(PKNotificationService, self).__init__()
36
+ # Subscribe to the event
37
+ globalEventsSignal.connect(self.notify)
38
+
39
+ def notify(self, sender, **kwargs):
40
+ if 'eventType' in kwargs:
41
+ if kwargs['eventType'] == "ga":
42
+ # Capture GA event
43
+ event_name = kwargs['event_name']
44
+ event_params = kwargs['event_params']
45
+ if event_params is None:
46
+ event_params = {}
47
+
48
+ payload = {
49
+ "client_id": str(uuid.uuid4()), # Unique client ID for GA
50
+ "events": [{
51
+ "name": event_name,
52
+ "params": event_params
53
+ }]
54
+ }
55
+ # Google Analytics API Details
56
+ MEASUREMENT_ID = "G-T0TLV56Y0C"
57
+ API_SECRET = "2dD6iqHQQl2EzhCvHXA7EQ"
58
+ GA_ENDPOINT = f"https://www.google-analytics.com/mp/collect?measurement_id={MEASUREMENT_ID}&api_secret={API_SECRET}"
59
+
60
+ try:
61
+ response = requests.post(GA_ENDPOINT, json=payload)
62
+ # if response.status_code == 204:
63
+ # print(f"Event '{event_name}' sent successfully")
64
+ # else:
65
+ # print(f"Error sending event: {response.text}")
66
+ except Exception as e:
67
+ # print(f"Failed to send event: {e}")
68
+ pass
69
+ else:
70
+ notificationText = kwargs['notification'] if 'notification' in kwargs else ""
71
+ scannerID = kwargs['scannerID'] if 'scannerID' in kwargs else ""
72
+ print(f"[Notification] Notifying for {scannerID} with data: {notificationText}")
73
+ dbManager = DBManager()
74
+ try:
75
+ if len(str(scannerID)) > 0:
76
+ userIDs = dbManager.usersForScannerJobId(scannerJobId=scannerID)
77
+ if len(userIDs) > 0:
78
+ for userID in userIDs:
79
+ send_message(message=notificationText,userID=userID,parse_type="HTML",)
80
+ else:
81
+ print(f"Error encountered:\n0 length scannerID passed for {notificationText}")
82
+ except Exception as e:
83
+ print(f"Error encountered:\n{e}")
84
+ pass
85
+
86
+ # Ensure the subscriber is instantiated so it listens to events
87
+ notification_service = PKNotificationService()
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: PKDevTools
3
- Version: 0.13.20250218.236
3
+ Version: 0.13.20250221.238
4
4
  Summary: A general day-to-day toolset for PKScreener repos
5
5
  Home-page: https://github.com/pkjmesra/PKDevTools
6
- Download-URL: https://github.com/pkjmesra/PKDevTools/archive/v0.13.20250218.236.zip
6
+ Download-URL: https://github.com/pkjmesra/PKDevTools/archive/v0.13.20250221.238.zip
7
7
  Author: pkjmesra
8
8
  Author-email: pkjmesra@gmail.com
9
9
  License: OSI Approved (MIT)
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: PKDevTools
3
- Version: 0.13.20250218.236
3
+ Version: 0.13.20250221.238
4
4
  Summary: A general day-to-day toolset for PKScreener repos
5
5
  Home-page: https://github.com/pkjmesra/PKDevTools
6
- Download-URL: https://github.com/pkjmesra/PKDevTools/archive/v0.13.20250218.236.zip
6
+ Download-URL: https://github.com/pkjmesra/PKDevTools/archive/v0.13.20250221.238.zip
7
7
  Author: pkjmesra
8
8
  Author-email: pkjmesra@gmail.com
9
9
  License: OSI Approved (MIT)
@@ -1 +0,0 @@
1
- VERSION='0.13.20250218.236'
@@ -1,54 +0,0 @@
1
- """
2
- The MIT License (MIT)
3
-
4
- Copyright (c) 2023 pkjmesra
5
-
6
- Permission is hereby granted, free of charge, to any person obtaining a copy
7
- of this software and associated documentation files (the "Software"), to deal
8
- in the Software without restriction, including without limitation the rights
9
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- copies of the Software, and to permit persons to whom the Software is
11
- furnished to do so, subject to the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be included in all
14
- copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- SOFTWARE.
23
-
24
- """
25
- from PKDevTools.classes.pubsub.events import globalEventsSignal
26
- from PKDevTools.classes.DBManager import DBManager
27
- from PKDevTools.classes.Telegram import send_message
28
-
29
- class PKNotificationService:
30
- def __init__(self):
31
- # Subscribe to the event
32
- globalEventsSignal.connect(self.notify)
33
-
34
- def notify(self, sender, **kwargs):
35
- notificationText = kwargs['notification'] if 'notification' in kwargs else ""
36
- scannerID = kwargs['scannerID'] if 'scannerID' in kwargs else ""
37
- print(f"[Notification] Notifying for {scannerID} with data: {notificationText}")
38
- dbManager = DBManager()
39
- try:
40
- if len(str(scannerID)) > 0:
41
- userIDs = dbManager.usersForScannerJobId(scannerJobId=scannerID)
42
- if len(userIDs) > 0:
43
- for userID in userIDs:
44
- send_message(message=notificationText,userID=userID,parse_type="HTML",)
45
- else:
46
- print(f"Error encountered:\n0 length scannerID passed for {notificationText}")
47
- except Exception as e:
48
- print(f"Error encountered:\n{e}")
49
- pass
50
-
51
-
52
-
53
- # Ensure the subscriber is instantiated so it listens to events
54
- notification_service = PKNotificationService()