new features #13

Merged
WorldTeacher merged 9 commits from dev into main 2025-12-09 08:18:04 +00:00
Showing only changes of commit 284e7dce67 - Show all commits

View File

@@ -26,7 +26,9 @@ SIGNATURE = "RDS_SIGNATURE"
EDITION = "RDS_EDITION"
ISBN = "RDS_ISBN"
AUTHOR = "RDS_PERSON"
ALLOWED_IPS = [
"193.197.140.245", # PHFR Internal
]
HEADERS = {
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 \
(HTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36",
@@ -56,10 +58,11 @@ class WebRequest:
self.data = None
self.timeout = 5
self.public_ip = None
self._can_run()
if self.public_ip not in ALLOWED_IPS:
raise PermissionError("IP not allowed to access the requested data.")
self.canrun()
def canrun(self) -> None:
def _can_run(self) -> None:
"""Check if requests can be made."""
try:
# check public IP to see if the requested data can be accessed