Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions 8 domaintools/api.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
from datetime import datetime, timedelta, timezone
from hashlib import sha1, sha256
from hmac import new as hmac
from pathlib import Path
from typing import Union

import re
import ssl
import yaml


from domaintools.constants import (
Endpoint,
OutputFormat,
Expand Down Expand Up @@ -111,17 +113,19 @@ def __init__(
raise Exception("Proxy URL must be a string. For example: '127.0.0.1:8888'")

def _initialize_specs(self):
package_root = Path(__file__).parent
for spec_name, file_path in SPECS_MAPPING.items():
specs_file_path = f"{package_root}/specs/{file_path}"
try:
with open(file_path, "r", encoding="utf-8") as f:
with open(specs_file_path, "r", encoding="utf-8") as f:
spec_content = yaml.safe_load(f)
if not spec_content:
raise ValueError("Spec file is empty or invalid.")

self.specs[spec_name] = spec_content

except Exception as e:
print(f"Error loading {file_path}: {e}")
print(f"Error loading {specs_file_path}: {e}")

def _get_ssl_default_context(self, verify_ssl: Union[str, bool]):
return (
Expand Down
4 changes: 2 additions & 2 deletions 4 domaintools/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@ class OutputFormat(Enum):
}

SPECS_MAPPING = {
"iris": "domaintools/specs/iris-openapi.yaml",
# "rttf": "domaintools/specs/feeds-openapi.yaml",
"iris": "iris-openapi.yaml",
# "rttf": "feeds-openapi.yaml",
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.