PKDevTools 0.13.20250212.224__tar.gz → 0.13.20250212.226__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/PKDevTools/classes/DBManager.py +26 -19
  2. pkdevtools-0.13.20250212.226/PKDevTools/classes/__init__.py +1 -0
  3. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/PKDevTools.egg-info/PKG-INFO +2 -2
  4. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/PKG-INFO +2 -2
  5. pkdevtools-0.13.20250212.224/PKDevTools/classes/__init__.py +0 -1
  6. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/LICENSE +0 -0
  7. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/PKDevTools/LICENSE.txt +0 -0
  8. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/PKDevTools/README.txt +0 -0
  9. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/PKDevTools/__init__.py +0 -0
  10. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/PKDevTools/classes/Archiver.py +0 -0
  11. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/PKDevTools/classes/ColorText.py +0 -0
  12. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/PKDevTools/classes/Committer.py +0 -0
  13. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/PKDevTools/classes/CookieHelper.py +0 -0
  14. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/PKDevTools/classes/Environment.py +0 -0
  15. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/PKDevTools/classes/Fetcher.py +0 -0
  16. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/PKDevTools/classes/FunctionTimeouts.py +0 -0
  17. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/PKDevTools/classes/GmailReader.py +0 -0
  18. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/PKDevTools/classes/MarketHours.py +0 -0
  19. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/PKDevTools/classes/MenuOptions.py +0 -0
  20. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/PKDevTools/classes/NSEMarketStatus.py +0 -0
  21. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/PKDevTools/classes/OutputControls.py +0 -0
  22. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/PKDevTools/classes/PKDateUtilities.py +0 -0
  23. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/PKDevTools/classes/PKGitFolderDownloader.py +0 -0
  24. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/PKDevTools/classes/PKJoinableQueue.py +0 -0
  25. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/PKDevTools/classes/PKMultiProcessorClient.py +0 -0
  26. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/PKDevTools/classes/PKPickler.py +0 -0
  27. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/PKDevTools/classes/PKTimer.py +0 -0
  28. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/PKDevTools/classes/Pikey.py +0 -0
  29. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/PKDevTools/classes/Singleton.py +0 -0
  30. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/PKDevTools/classes/SuppressOutput.py +0 -0
  31. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/PKDevTools/classes/System.py +0 -0
  32. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/PKDevTools/classes/Telegram.py +0 -0
  33. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/PKDevTools/classes/UserSubscriptions.py +0 -0
  34. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/PKDevTools/classes/Utils.py +0 -0
  35. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/PKDevTools/classes/WorkflowManager.py +0 -0
  36. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/PKDevTools/classes/githubutilities.py +0 -0
  37. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/PKDevTools/classes/log.py +0 -0
  38. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/PKDevTools/classes/multiprocessing_logging.py +0 -0
  39. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/PKDevTools/classes/squash.py +0 -0
  40. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/PKDevTools/classes/updater.py +0 -0
  41. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/PKDevTools/release.md +0 -0
  42. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/PKDevTools/requirements.txt +0 -0
  43. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/PKDevTools.egg-info/SOURCES.txt +0 -0
  44. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/PKDevTools.egg-info/dependency_links.txt +0 -0
  45. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/PKDevTools.egg-info/entry_points.txt +0 -0
  46. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/PKDevTools.egg-info/not-zip-safe +0 -0
  47. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/PKDevTools.egg-info/requires.txt +0 -0
  48. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/PKDevTools.egg-info/top_level.txt +0 -0
  49. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/README.md +0 -0
  50. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/setup.cfg +0 -0
  51. {pkdevtools-0.13.20250212.224 → pkdevtools-0.13.20250212.226}/setup.py +0 -0
@@ -72,23 +72,27 @@ class PKUser:
72
72
  lastotp=""
73
73
  balance = 0
74
74
  scannerJobs = []
75
+ customeField = None
75
76
 
76
77
  def userFromDBRecord(row):
77
78
  user = PKUser()
78
- user.userid= row[0]
79
- user.username= row[1]
80
- user.name= row[2]
81
- user.email= row[3]
82
- user.mobile= row[4]
83
- user.otpvaliduntil= row[5]
84
- user.totptoken= row[6]
85
- user.subscriptionmodel= row[7]
86
- user.lastotp= row[8]
79
+ user.userid= row[0] if len(row) > 0 else None
80
+ if len(row) < 9:
81
+ user.customeField = row[0] if len(row) > 0 else None
82
+ user.username= row[1] if len(row) > 1 else None
83
+ user.name= row[2] if len(row) > 2 else None
84
+ user.email= row[3] if len(row) > 3 else None
85
+ user.mobile= row[4] if len(row) > 4 else None
86
+ user.otpvaliduntil= row[5] if len(row) > 5 else None
87
+ user.totptoken= row[6] if len(row) > 6 else None
88
+ user.subscriptionmodel= row[7] if len(row) > 7 else None
89
+ user.lastotp= row[8] if len(row) > 8 else None
87
90
  return user
88
91
 
89
- def userFromAlertsRecord(row):
90
- user = PKUser()
91
- user.userid= row[0]
92
+ def userFromAlertsRecord(row,user=None):
93
+ if user is None:
94
+ user = PKUser()
95
+ user.userid= row[0]
92
96
  user.balance= row[1]
93
97
  user.scannerJobs = []
94
98
  for job in row[2].split(";"):
@@ -172,6 +176,7 @@ class DBManager:
172
176
  def getOTP(self,userID,username=None,name=None,retry=False,validityIntervalInSeconds=86400):
173
177
  try:
174
178
  otpValue = 0
179
+ user = None
175
180
  dbUsers = self.getUserByID(int(userID))
176
181
  if len(dbUsers) > 0:
177
182
  dbUser = dbUsers[0]
@@ -211,7 +216,8 @@ class DBManager:
211
216
  print(f"Could not get/update (getOTP) OTP for user: {user.userid}\n{e}")
212
217
  default_logger().debug(e, exc_info=True)
213
218
  pass
214
- return otpValue, subscriptionModel, subscriptionValidity
219
+ alertUser = self.alertsForUser(userID,user=user)
220
+ return otpValue, subscriptionModel, subscriptionValidity, alertUser
215
221
 
216
222
  def getUserByID(self,userID):
217
223
  try:
@@ -332,14 +338,15 @@ class DBManager:
332
338
  self.conn.close()
333
339
  self.conn = None
334
340
 
335
- def getUsers(self):
341
+ def getUsers(self,fieldName=None):
336
342
  """
337
343
  Returns all active PKUser instances in the database or an empty list if none is found.
344
+ Returns only the fieldName if requested.
338
345
  """
339
346
  try:
340
347
  users = []
341
348
  cursor = self.connection() #.cursor()
342
- records = cursor.execute(f"SELECT * FROM users") #.fetchall()
349
+ records = cursor.execute(f"SELECT {'*' if fieldName is None else fieldName} FROM users") #.fetchall()
343
350
  for row in records.rows:
344
351
  users.append(PKUser.userFromDBRecord(row))
345
352
  # cursor.close()
@@ -356,7 +363,7 @@ class DBManager:
356
363
  self.conn = None
357
364
  return users
358
365
 
359
- def alertsForUser(self,userID:int):
366
+ def alertsForUser(self,userID:int,user:PKUser=None):
360
367
  """
361
368
  Returns a PKUser instance with user's updated balance for daily alerts
362
369
  and relevant subscribed scannerJobs for a given userID or None.
@@ -364,9 +371,9 @@ class DBManager:
364
371
  try:
365
372
  users = []
366
373
  cursor = self.connection()
367
- records = cursor.execute(f"SELECT * FROM alertsubscriptions where userId={self.sanitisedIntValue(userID)}")
374
+ records = cursor.execute(f"SELECT * FROM alertsubscriptions where userId={self.sanitisedIntValue(userID if user is None else user.userid)}")
368
375
  for row in records.rows:
369
- users.append(PKUser.userFromAlertsRecord(row))
376
+ users.append(PKUser.userFromAlertsRecord(row,user=user))
370
377
  # cursor.close()
371
378
  if len(records.columns) > 0 and len(records.rows) <= 0:
372
379
  default_logger().debug(f"Users not found!")
@@ -545,4 +552,4 @@ class DBManager:
545
552
  if self.conn is not None:
546
553
  self.conn.close()
547
554
  self.conn = None
548
- return success1 and success2
555
+ return success1 and success2
@@ -0,0 +1 @@
1
+ VERSION='0.13.20250212.226'
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: PKDevTools
3
- Version: 0.13.20250212.224
3
+ Version: 0.13.20250212.226
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.20250212.224.zip
6
+ Download-URL: https://github.com/pkjmesra/PKDevTools/archive/v0.13.20250212.226.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.20250212.224
3
+ Version: 0.13.20250212.226
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.20250212.224.zip
6
+ Download-URL: https://github.com/pkjmesra/PKDevTools/archive/v0.13.20250212.226.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.20250212.224'