Skip to content
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ Custom parameters aside from the common `GET` Request parameters:
api = API(USERNAME, KEY, always_sign_api_key=False)
api.nod(endpoint="feed", **kwargs)
```
- `header_authentication`: by default, we're using API Header Authentication. Set this False if you want to use API Key and Secret Authentication. Apparently, you can't use API Header Authentication for `download` endpoints so you need to set this to `False` when calling `download` API endpoints.
- `header_authentication`: by default, we're using API Header Authentication. Set this False if you want to use API Key and Secret Authentication. Apparently, you can't use API Header Authentication for `download` endpoints so this will be defaulted to `False` even without explicitly setting it.
```python
api = API(USERNAME, KEY, always_sign_api_key=False)
api.nod(header_authentication=False, **kwargs)
Expand Down
7 changes: 2 additions & 5 deletions domaintools/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,8 @@ def __init__(

if not https:
raise Exception("The DomainTools API endpoints no longer support http traffic. Please make sure https=True.")
if proxy_url:
if isinstance(proxy_url, str):
self.proxy_url = {"http://": proxy_url, "https://": proxy_url}
else:
raise Exception("Proxy URL must be a string. For example: '127.0.0.1:8888'")
if proxy_url and not isinstance(proxy_url, str):
raise Exception("Proxy URL must be a string. For example: '127.0.0.1:8888'")

def _build_api_url(self, api_url=None, api_port=None):
"""Build the API url based on the given url and port. Defaults to `https://api.domaintools.com`"""
Expand Down
3 changes: 2 additions & 1 deletion domaintools/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,5 @@ def validate_feeds_parameters(params):
raise ValueError(f"{format} format is not available in {Endpoint.DOWNLOAD.value} API.")

if endpoint == Endpoint.DOWNLOAD.value and params.get("header_authentication", True):
raise ValueError(f"{Endpoint.DOWNLOAD.value} API does not support header authentication. Provide api_key in the parameter")
# For download endpoint, header_authentication will be False by default
params["header_authentication"] = False
Loading
Loading