log-arbor 0.1.0__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.
@@ -0,0 +1,13 @@
1
+ Metadata-Version: 2.4
2
+ Name: log-arbor
3
+ Version: 0.1.0
4
+ Summary: This is a library that is used in order to interact with LogArbor.
5
+ Author: Platon
6
+ Author-email: Platon <platon.tikhnenko@gmail.com>
7
+ License-Expression: MIT
8
+ Requires-Dist: datetime>=6.0
9
+ Requires-Dist: python-dotenv>=1.2.1
10
+ Requires-Dist: requests>=2.32.5
11
+ Requires-Python: >=3.14
12
+ Description-Content-Type: text/markdown
13
+
File without changes
@@ -0,0 +1,19 @@
1
+ [project]
2
+ name = "log-arbor"
3
+ version = "0.1.0"
4
+ description = "This is a library that is used in order to interact with LogArbor."
5
+ readme = "README.md"
6
+ license = "MIT"
7
+ authors = [
8
+ { name = "Platon", email = "platon.tikhnenko@gmail.com" }
9
+ ]
10
+ requires-python = ">=3.14"
11
+ dependencies = [
12
+ "datetime>=6.0",
13
+ "python-dotenv>=1.2.1",
14
+ "requests>=2.32.5",
15
+ ]
16
+
17
+ [build-system]
18
+ requires = ["uv_build>=0.9.21,<0.10.0"]
19
+ build-backend = "uv_build"
@@ -0,0 +1,2 @@
1
+ def hello() -> str:
2
+ return "Hello from log-arbor!"
File without changes
@@ -0,0 +1,32 @@
1
+ import requests
2
+ import os
3
+ from dotenv import load_dotenv
4
+ from datetime import datetime
5
+ from requests.exceptions import RequestException
6
+
7
+ load_dotenv()
8
+
9
+ def log(service_id: str, level: str, message: str):
10
+ """Pushes the log to a service through LogArbor Logs API"""
11
+
12
+ current_time_format_string = "%Y-%m-%d %H:%M:%S"
13
+ current_datetime_object = datetime.now()
14
+
15
+ try:
16
+ log_json = {
17
+ "service_id": service_id,
18
+ "token": os.getenv("LOGARBOR_API_TOKEN"),
19
+ "message": message,
20
+ "level": level,
21
+ "time": current_datetime_object.strftime(current_time_format_string)
22
+ }
23
+
24
+
25
+ response = requests.post(os.getenv("LOGARBOR_LOG_API"), json=log_json)
26
+
27
+ if not response.status_code == 200:
28
+ return {"message": response.json().get("message")}
29
+ except RequestException as e:
30
+ return {"message": f"An error occurred while accessing Log API: {e}"}
31
+ except Exception as e:
32
+ return {"message": f"An error occurred during the log function: {e}"}