queue-local 0.0.29__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.
- {queue-local-0.0.29 → queue-local-0.0.30}/PKG-INFO +2 -1
- {queue-local-0.0.29 → queue-local-0.0.30}/queue_local/src/database_queue.py +11 -2
- {queue-local-0.0.29 → queue-local-0.0.30}/queue_local.egg-info/PKG-INFO +2 -1
- {queue-local-0.0.29 → queue-local-0.0.30}/queue_local.egg-info/SOURCES.txt +1 -2
- {queue-local-0.0.29 → queue-local-0.0.30}/queue_local.egg-info/requires.txt +1 -0
- {queue-local-0.0.29 → queue-local-0.0.30}/setup.py +4 -2
- queue-local-0.0.29/queue_local/src/utils.py +0 -39
- {queue-local-0.0.29 → queue-local-0.0.30}/README.md +0 -0
- {queue-local-0.0.29 → queue-local-0.0.30}/pyproject.toml +0 -0
- {queue-local-0.0.29 → queue-local-0.0.30}/queue_local/src/__init__.py +0 -0
- {queue-local-0.0.29 → queue-local-0.0.30}/queue_local/src/our_queue.py +0 -0
- {queue-local-0.0.29 → queue-local-0.0.30}/queue_local.egg-info/dependency_links.txt +0 -0
- {queue-local-0.0.29 → queue-local-0.0.30}/queue_local.egg-info/top_level.txt +0 -0
- {queue-local-0.0.29 → queue-local-0.0.30}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: queue-local
|
|
3
|
-
Version: 0.0.
|
|
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
|
|
@@ -11,12 +13,14 @@ from logger_local.LoggerComponentEnum import LoggerComponentEnum
|
|
|
11
13
|
from user_context_remote.user_context import UserContext
|
|
12
14
|
|
|
13
15
|
from .our_queue import OurQueue
|
|
14
|
-
from .utils import get_thread_id, get_ipv6, get_ipv4
|
|
15
16
|
|
|
16
17
|
QUEUE_LOCAL_PYTHON_COMPONENT_ID = 155
|
|
17
18
|
QUEUE_LOCAL_PYTHON_COMPONENT_NAME = "queue_local/src/database_queue.py"
|
|
18
19
|
DEVELOPER_EMAIL = 'akiva.s@circ.zone'
|
|
19
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
|
+
|
|
20
24
|
|
|
21
25
|
class StatusEnum(Enum):
|
|
22
26
|
NEW = 0
|
|
@@ -106,7 +110,7 @@ class DatabaseQueue(OurQueue, GenericCRUD):
|
|
|
106
110
|
f"server_ip_v4=%s, server_ip_v6=%s, start_timestamp = NOW() " \
|
|
107
111
|
f"WHERE {self.id_column_name} = %s"
|
|
108
112
|
params = (StatusEnum.RETRIEVED.value, updated_user_id, self.user.get_user_JWT(),
|
|
109
|
-
get_thread_id(),
|
|
113
|
+
get_thread_id(), ip_v4, ip_v6, queue_item[self.id_column_name])
|
|
110
114
|
self.cursor.execute(query, params)
|
|
111
115
|
self.logger.end("Entry retrieved and updated from the queue database successfully",
|
|
112
116
|
object={k: str(v) for k, v in queue_item.items()}) # contains a datetime object
|
|
@@ -152,3 +156,8 @@ class DatabaseQueue(OurQueue, GenericCRUD):
|
|
|
152
156
|
data_json[key] = value.replace("'", '"')
|
|
153
157
|
else:
|
|
154
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.
|
|
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
|
|
|
@@ -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.
|
|
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
|
)
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import socket
|
|
2
|
-
import threading
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
def get_ipv4():
|
|
6
|
-
# Get the local machine's IPv4 and IPv6 addresses
|
|
7
|
-
try:
|
|
8
|
-
ipv4_address = socket.gethostbyname(socket.gethostname())
|
|
9
|
-
except Exception as e:
|
|
10
|
-
ipv4_address = None
|
|
11
|
-
print("Error getting IPv4 address " + str(e))
|
|
12
|
-
return ipv4_address
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
def get_ipv6():
|
|
16
|
-
try:
|
|
17
|
-
ipv6_address = socket.getaddrinfo(socket.gethostname(), None, socket.AF_INET6)[0][4][0]
|
|
18
|
-
except Exception as e:
|
|
19
|
-
ipv6_address = None
|
|
20
|
-
print("Error getting IPv6 address " + str(e))
|
|
21
|
-
return ipv6_address
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
def get_thread_id():
|
|
25
|
-
# Get the current thread ID
|
|
26
|
-
return threading.current_thread().ident
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
# Example usage
|
|
30
|
-
if __name__ == "__main__":
|
|
31
|
-
# Get and print the IPv4 and IPv6 addresses
|
|
32
|
-
ipv4_address = get_ipv4()
|
|
33
|
-
ipv6_address = get_ipv6()
|
|
34
|
-
print(f"IPv4 Address: {ipv4_address}")
|
|
35
|
-
print(f"IPv6 Address: {ipv6_address}")
|
|
36
|
-
|
|
37
|
-
# Get and print the thread ID
|
|
38
|
-
thread_id = get_thread_id()
|
|
39
|
-
print(f"Thread ID: {thread_id}")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|