queue-local 0.0.28__tar.gz → 0.0.30__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: queue-local
3
- Version: 0.0.28
3
+ Version: 0.0.30
4
4
  Home-page: https://github.com/circles-zone/queue-local-python-package
5
5
  Author: Circles
6
6
  Author-email: info@circles.life
@@ -13,6 +13,7 @@ Requires-Dist: pytest>=7.4.1
13
13
  Requires-Dist: database-mysql-local>=0.0.120
14
14
  Requires-Dist: logger-local>=0.0.59
15
15
  Requires-Dist: user-context-remote>=0.0.30
16
+ Requires-Dist: requests>=2.22.0
16
17
 
17
18
  # queue-local-python-package
18
19
 
@@ -1,9 +1,11 @@
1
1
  import json
2
2
  import os
3
+ import threading
3
4
  from collections.abc import Iterable
4
5
  from enum import Enum
5
6
 
6
7
  import mysql.connector
8
+ import requests
7
9
  from circles_local_database_python.connector import Connector
8
10
  from circles_local_database_python.generic_crud import GenericCRUD
9
11
  from logger_local.Logger import Logger
@@ -16,6 +18,9 @@ QUEUE_LOCAL_PYTHON_COMPONENT_ID = 155
16
18
  QUEUE_LOCAL_PYTHON_COMPONENT_NAME = "queue_local/src/database_queue.py"
17
19
  DEVELOPER_EMAIL = 'akiva.s@circ.zone'
18
20
 
21
+ ip_v4 = requests.get('https://ipv4.seeip.org/jsonip').json()['ip']
22
+ ip_v6 = requests.get('https://api.seeip.org/jsonip').json()['ip']
23
+
19
24
 
20
25
  class StatusEnum(Enum):
21
26
  NEW = 0
@@ -101,10 +106,11 @@ class DatabaseQueue(OurQueue, GenericCRUD):
101
106
  if queue_item:
102
107
  # Update the selected queue item
103
108
  query = f"UPDATE {self.default_table_name} " \
104
- f"SET queue_status_id = %s, updated_user_id = %s, user_jwt=%s, start_timestamp = NOW() " \
109
+ f"SET queue_status_id=%s, updated_user_id=%s, user_jwt=%s, thread_id=%s," \
110
+ f"server_ip_v4=%s, server_ip_v6=%s, start_timestamp = NOW() " \
105
111
  f"WHERE {self.id_column_name} = %s"
106
112
  params = (StatusEnum.RETRIEVED.value, updated_user_id, self.user.get_user_JWT(),
107
- queue_item[self.id_column_name])
113
+ get_thread_id(), ip_v4, ip_v6, queue_item[self.id_column_name])
108
114
  self.cursor.execute(query, params)
109
115
  self.logger.end("Entry retrieved and updated from the queue database successfully",
110
116
  object={k: str(v) for k, v in queue_item.items()}) # contains a datetime object
@@ -150,3 +156,8 @@ class DatabaseQueue(OurQueue, GenericCRUD):
150
156
  data_json[key] = value.replace("'", '"')
151
157
  else:
152
158
  data_json[key] = json.dumps(value)
159
+
160
+
161
+ def get_thread_id():
162
+ """Returns the current thread ID"""
163
+ return threading.current_thread().ident
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: queue-local
3
- Version: 0.0.28
3
+ Version: 0.0.30
4
4
  Home-page: https://github.com/circles-zone/queue-local-python-package
5
5
  Author: Circles
6
6
  Author-email: info@circles.life
@@ -13,6 +13,7 @@ Requires-Dist: pytest>=7.4.1
13
13
  Requires-Dist: database-mysql-local>=0.0.120
14
14
  Requires-Dist: logger-local>=0.0.59
15
15
  Requires-Dist: user-context-remote>=0.0.30
16
+ Requires-Dist: requests>=2.22.0
16
17
 
17
18
  # queue-local-python-package
18
19
 
@@ -3,3 +3,4 @@ pytest>=7.4.1
3
3
  database-mysql-local>=0.0.120
4
4
  logger-local>=0.0.59
5
5
  user-context-remote>=0.0.30
6
+ requests>=2.22.0
@@ -8,7 +8,7 @@ with open('README.md') as f:
8
8
 
9
9
  setuptools.setup(
10
10
  name=PACKAGE_NAME, # https://pypi.org/project/queue-local
11
- version='0.0.28',
11
+ version='0.0.30',
12
12
  author="Circles",
13
13
  author_email="info@circles.life",
14
14
  url=f"https://github.com/circles-zone/{PACKAGE_NAME}-python-package",
@@ -26,5 +26,7 @@ setuptools.setup(
26
26
  "pytest>=7.4.1",
27
27
  "database-mysql-local>=0.0.120",
28
28
  "logger-local>=0.0.59",
29
- "user-context-remote>=0.0.30"]
29
+ "user-context-remote>=0.0.30",
30
+ "requests>=2.22.0",
31
+ ]
30
32
  )
File without changes
File without changes