Skip to content
This repository was archived by the owner on Nov 24, 2025. It is now read-only.

Commit f360994

Browse files
committed
Replace local notification code with wolfsoftware.notify package
1 parent f043f2a commit f360994

File tree

7 files changed

+12
-123
lines changed

7 files changed

+12
-123
lines changed

CITATION.cff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: Time to First Byte
44
abstract: Display the time-to-first-byte for any given url.
55
type: software
66
version: 0.1.0
7-
date-released: 2024-05-22
7+
date-released: 2024-05-23
88
repository-code: https://github.com/PlatformEngineersToolbox/time-to-first-byte-python
99
keywords:
1010
- "Wolf Software"

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
colorama==0.4.6
22
setuptools==70.0.0
33
wolfsoftware.drawlines==0.1.1
4+
wolfsoftware.notify==0.1.0
45
wolfsoftware.prereqs==0.1.1

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
setup(
1414
name='wolfsoftware.ttfb',
15-
version='0.1.0',
15+
version='0.1.1',
1616
author='Wolf Software',
1717
author_email='pypi@wolfsoftware.com',
1818
description='Display the time-to-first-byte for any given url.',

wolfsoftware/ttfb/constants.py

Lines changed: 0 additions & 32 deletions
This file was deleted.

wolfsoftware/ttfb/main.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@
1717

1818
import sys
1919

20+
from wolfsoftware.notify import system_message
21+
2022
from .cli import run
21-
from .notify import system
2223

2324

2425
def main() -> None:
@@ -34,7 +35,7 @@ def main() -> None:
3435
try:
3536
run()
3637
except KeyboardInterrupt:
37-
system("\n[*] Exiting Program\n")
38+
print(system_message("\n[*] Exiting Program\n"))
3839
sys.exit(1)
3940

4041

wolfsoftware/ttfb/notify.py

Lines changed: 0 additions & 81 deletions
This file was deleted.

wolfsoftware/ttfb/utils.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121

2222
import subprocess # nosec B404
2323

24+
from wolfsoftware.notify import error_message
2425
from wolfsoftware.prereqs import check_prerequisite, PrerequisiteCheckError
2526

2627
from .globals import prerequisite_commands
27-
from .notify import error
2828

2929

3030
def check_prereqs() -> dict:
@@ -45,7 +45,7 @@ def check_prereqs() -> dict:
4545
command_paths: dict = check_prerequisite(prerequisite_commands)
4646
return command_paths
4747
except PrerequisiteCheckError as errors:
48-
error("Prerequisite check failed:")
48+
print(error_message("Prerequisite check failed:"))
4949
for err in errors.errors:
5050
print(err)
5151
sys.exit(1)
@@ -66,7 +66,7 @@ def validate_url(url) -> None:
6666
If the URL does not exist or is unreachable, prints an error message and exits the program.
6767
"""
6868
if not isinstance(url, str) or not url.startswith(('http://', 'https://')):
69-
error("Invalid URL - must start with http:// or https://")
69+
print(error_message("Invalid URL - must start with http:// or https://"))
7070
sys.exit(1)
7171

7272
command: list[str] = ['curl', '-o', '/dev/null', '--silent', '--head', '--fail', '--connect-timeout', '1', url]
@@ -75,13 +75,13 @@ def validate_url(url) -> None:
7575
command, text=True, check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
7676

7777
if result.returncode != 0:
78-
error(f"{url} does not exist - aborting")
78+
print(error_message(f"{url} does not exist - aborting"))
7979
sys.exit(1)
8080

8181
except subprocess.CalledProcessError:
82-
error(f"{url} does not exist - aborting")
82+
print(error_message(f"{url} does not exist - aborting"))
8383
sys.exit(1)
8484

8585
except Exception:
86-
error(f"An unexpected error occurred while checking {url}")
86+
print(error_message(f"An unexpected error occurred while checking {url}"))
8787
sys.exit(1)

0 commit comments

Comments
 (0)