domaintools-api-test-upload 2.4.1__tar.gz → 2.5.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.
Files changed (41) hide show
  1. {domaintools_api_test_upload-2.4.1/domaintools_api_test_upload.egg-info → domaintools_api_test_upload-2.5.0}/PKG-INFO +41 -1
  2. {domaintools_api_test_upload-2.4.1 → domaintools_api_test_upload-2.5.0}/README.md +41 -1
  3. domaintools_api_test_upload-2.5.0/VERSION +1 -0
  4. {domaintools_api_test_upload-2.4.1 → domaintools_api_test_upload-2.5.0}/domaintools/_version.py +1 -1
  5. {domaintools_api_test_upload-2.4.1 → domaintools_api_test_upload-2.5.0}/domaintools/api.py +9 -4
  6. {domaintools_api_test_upload-2.4.1 → domaintools_api_test_upload-2.5.0/domaintools_api_test_upload.egg-info}/PKG-INFO +41 -1
  7. {domaintools_api_test_upload-2.4.1 → domaintools_api_test_upload-2.5.0}/tests/test_api.py +11 -1
  8. domaintools_api_test_upload-2.4.1/VERSION +0 -1
  9. {domaintools_api_test_upload-2.4.1 → domaintools_api_test_upload-2.5.0}/LICENSE +0 -0
  10. {domaintools_api_test_upload-2.4.1 → domaintools_api_test_upload-2.5.0}/domaintools/__init__.py +0 -0
  11. {domaintools_api_test_upload-2.4.1 → domaintools_api_test_upload-2.5.0}/domaintools/base_results.py +0 -0
  12. {domaintools_api_test_upload-2.4.1 → domaintools_api_test_upload-2.5.0}/domaintools/cli/__init__.py +0 -0
  13. {domaintools_api_test_upload-2.4.1 → domaintools_api_test_upload-2.5.0}/domaintools/cli/api.py +0 -0
  14. {domaintools_api_test_upload-2.4.1 → domaintools_api_test_upload-2.5.0}/domaintools/cli/commands/__init__.py +0 -0
  15. {domaintools_api_test_upload-2.4.1 → domaintools_api_test_upload-2.5.0}/domaintools/cli/commands/accounts.py +0 -0
  16. {domaintools_api_test_upload-2.4.1 → domaintools_api_test_upload-2.5.0}/domaintools/cli/commands/detects.py +0 -0
  17. {domaintools_api_test_upload-2.4.1 → domaintools_api_test_upload-2.5.0}/domaintools/cli/commands/domains.py +0 -0
  18. {domaintools_api_test_upload-2.4.1 → domaintools_api_test_upload-2.5.0}/domaintools/cli/commands/feeds.py +0 -0
  19. {domaintools_api_test_upload-2.4.1 → domaintools_api_test_upload-2.5.0}/domaintools/cli/commands/ips.py +0 -0
  20. {domaintools_api_test_upload-2.4.1 → domaintools_api_test_upload-2.5.0}/domaintools/cli/commands/iris.py +0 -0
  21. {domaintools_api_test_upload-2.4.1 → domaintools_api_test_upload-2.5.0}/domaintools/cli/constants.py +0 -0
  22. {domaintools_api_test_upload-2.4.1 → domaintools_api_test_upload-2.5.0}/domaintools/cli/main.py +0 -0
  23. {domaintools_api_test_upload-2.4.1 → domaintools_api_test_upload-2.5.0}/domaintools/cli/utils.py +0 -0
  24. {domaintools_api_test_upload-2.4.1 → domaintools_api_test_upload-2.5.0}/domaintools/constants.py +0 -0
  25. {domaintools_api_test_upload-2.4.1 → domaintools_api_test_upload-2.5.0}/domaintools/exceptions.py +0 -0
  26. {domaintools_api_test_upload-2.4.1 → domaintools_api_test_upload-2.5.0}/domaintools/filters.py +0 -0
  27. {domaintools_api_test_upload-2.4.1 → domaintools_api_test_upload-2.5.0}/domaintools/results.py +0 -0
  28. {domaintools_api_test_upload-2.4.1 → domaintools_api_test_upload-2.5.0}/domaintools/utils.py +0 -0
  29. {domaintools_api_test_upload-2.4.1 → domaintools_api_test_upload-2.5.0}/domaintools_api_test_upload.egg-info/SOURCES.txt +0 -0
  30. {domaintools_api_test_upload-2.4.1 → domaintools_api_test_upload-2.5.0}/domaintools_api_test_upload.egg-info/dependency_links.txt +0 -0
  31. {domaintools_api_test_upload-2.4.1 → domaintools_api_test_upload-2.5.0}/domaintools_api_test_upload.egg-info/entry_points.txt +0 -0
  32. {domaintools_api_test_upload-2.4.1 → domaintools_api_test_upload-2.5.0}/domaintools_api_test_upload.egg-info/requires.txt +0 -0
  33. {domaintools_api_test_upload-2.4.1 → domaintools_api_test_upload-2.5.0}/domaintools_api_test_upload.egg-info/top_level.txt +0 -0
  34. {domaintools_api_test_upload-2.4.1 → domaintools_api_test_upload-2.5.0}/domaintools_async/__init__.py +0 -0
  35. {domaintools_api_test_upload-2.4.1 → domaintools_api_test_upload-2.5.0}/pyproject.toml +0 -0
  36. {domaintools_api_test_upload-2.4.1 → domaintools_api_test_upload-2.5.0}/setup.cfg +0 -0
  37. {domaintools_api_test_upload-2.4.1 → domaintools_api_test_upload-2.5.0}/setup.py +0 -0
  38. {domaintools_api_test_upload-2.4.1 → domaintools_api_test_upload-2.5.0}/tests/test_async.py +0 -0
  39. {domaintools_api_test_upload-2.4.1 → domaintools_api_test_upload-2.5.0}/tests/test_cli.py +0 -0
  40. {domaintools_api_test_upload-2.4.1 → domaintools_api_test_upload-2.5.0}/tests/test_filters.py +0 -0
  41. {domaintools_api_test_upload-2.4.1 → domaintools_api_test_upload-2.5.0}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: domaintools_api_test_upload
3
- Version: 2.4.1
3
+ Version: 2.5.0
4
4
  Summary: DomainTools Official Python API
5
5
  Author-email: DomainTools <integrations@domaintools.com>
6
6
  License: The MIT License (MIT)
@@ -321,3 +321,43 @@ results = api.nod(sessionID="my-session-id", after=-7200)
321
321
  for partial_result in results.response() # generator that holds NOD feeds data for the past 2 hours and is expected to request multiple times
322
322
  # do things to partial_result
323
323
  ```
324
+
325
+
326
+ Running E2E Tests Locally
327
+ ===================
328
+ For now, e2e tests only covers proxy and ssl testing. We are expected to broaden our e2e tests to other scenarios moving forward.
329
+ To add more e2e tests, put these in the `../tests/e2e` folder.
330
+
331
+ ## Preparation
332
+ - Create virtual environment.
333
+ ```bash
334
+ python3 -m venv venv
335
+ ```
336
+
337
+ - Activate virtual environment
338
+ ```bash
339
+ source venv/bin/activate
340
+ ```
341
+
342
+ - Install dependencies.
343
+ ```bash
344
+ pip install -r requirements/development.txt
345
+ ```
346
+
347
+ - From the python_api project root directory, install the package.
348
+ ```bash
349
+ pip install -e .
350
+ ```
351
+
352
+ - Export api credentials to use.
353
+ ```bash
354
+ export TEST_USER=<user-key>
355
+ export TEST_KEY=<api-key>
356
+ ```
357
+
358
+ ## Run the end-to-end test script
359
+ - Before running the test, be sure that docker is running.
360
+ - Execute the e2e test script .
361
+ ```bash
362
+ sh tests/e2e/scripts/test_e2e_runner.sh
363
+ ```
@@ -270,4 +270,44 @@ results = api.nod(sessionID="my-session-id", after=-7200)
270
270
 
271
271
  for partial_result in results.response() # generator that holds NOD feeds data for the past 2 hours and is expected to request multiple times
272
272
  # do things to partial_result
273
- ```
273
+ ```
274
+
275
+
276
+ Running E2E Tests Locally
277
+ ===================
278
+ For now, e2e tests only covers proxy and ssl testing. We are expected to broaden our e2e tests to other scenarios moving forward.
279
+ To add more e2e tests, put these in the `../tests/e2e` folder.
280
+
281
+ ## Preparation
282
+ - Create virtual environment.
283
+ ```bash
284
+ python3 -m venv venv
285
+ ```
286
+
287
+ - Activate virtual environment
288
+ ```bash
289
+ source venv/bin/activate
290
+ ```
291
+
292
+ - Install dependencies.
293
+ ```bash
294
+ pip install -r requirements/development.txt
295
+ ```
296
+
297
+ - From the python_api project root directory, install the package.
298
+ ```bash
299
+ pip install -e .
300
+ ```
301
+
302
+ - Export api credentials to use.
303
+ ```bash
304
+ export TEST_USER=<user-key>
305
+ export TEST_KEY=<api-key>
306
+ ```
307
+
308
+ ## Run the end-to-end test script
309
+ - Before running the test, be sure that docker is running.
310
+ - Execute the e2e test script .
311
+ ```bash
312
+ sh tests/e2e/scripts/test_e2e_runner.sh
313
+ ```
@@ -0,0 +1 @@
1
+ 2.5.0
@@ -20,4 +20,4 @@ OTHER DEALINGS IN THE SOFTWARE.
20
20
 
21
21
  """
22
22
 
23
- current = "2.4.1"
23
+ current = "2.5.0"
@@ -1,8 +1,10 @@
1
1
  from datetime import datetime, timedelta, timezone
2
- from hashlib import sha1, sha256, md5
2
+ from hashlib import sha1, sha256
3
3
  from hmac import new as hmac
4
+ from typing import Union
4
5
 
5
6
  import re
7
+ import ssl
6
8
 
7
9
  from domaintools.constants import Endpoint, ENDPOINT_TO_SOURCE_MAP, FEEDS_PRODUCTS_LIST, OutputFormat
8
10
  from domaintools._version import current as version
@@ -24,7 +26,7 @@ from domaintools.filters import (
24
26
  from domaintools.utils import validate_feeds_parameters
25
27
 
26
28
 
27
- AVAILABLE_KEY_SIGN_HASHES = ["sha1", "sha256", "md5"]
29
+ AVAILABLE_KEY_SIGN_HASHES = ["sha1", "sha256"]
28
30
 
29
31
 
30
32
  def delimited(items, character="|"):
@@ -76,7 +78,7 @@ class API(object):
76
78
  self.username = username
77
79
  self.key = key
78
80
  self.https = https
79
- self.verify_ssl = verify_ssl
81
+ self.verify_ssl = self._get_ssl_default_context(verify_ssl)
80
82
  self.rate_limit = rate_limit
81
83
  self.proxy_url = proxy_url
82
84
  self.extra_request_params = {}
@@ -92,9 +94,12 @@ class API(object):
92
94
  if proxy_url and not isinstance(proxy_url, str):
93
95
  raise Exception("Proxy URL must be a string. For example: '127.0.0.1:8888'")
94
96
 
97
+ def _get_ssl_default_context(self, verify_ssl: Union[str, bool]):
98
+ return ssl.create_default_context(cafile=verify_ssl) if isinstance(verify_ssl, str) else verify_ssl
99
+
95
100
  def _build_api_url(self, api_url=None, api_port=None):
96
101
  """Build the API url based on the given url and port. Defaults to `https://api.domaintools.com`"""
97
- rest_api_url = "https://api.domaintools.com.test"
102
+ rest_api_url = "https://api.domaintools.com"
98
103
  if api_url:
99
104
  rest_api_url = api_url
100
105
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: domaintools_api_test_upload
3
- Version: 2.4.1
3
+ Version: 2.5.0
4
4
  Summary: DomainTools Official Python API
5
5
  Author-email: DomainTools <integrations@domaintools.com>
6
6
  License: The MIT License (MIT)
@@ -321,3 +321,43 @@ results = api.nod(sessionID="my-session-id", after=-7200)
321
321
  for partial_result in results.response() # generator that holds NOD feeds data for the past 2 hours and is expected to request multiple times
322
322
  # do things to partial_result
323
323
  ```
324
+
325
+
326
+ Running E2E Tests Locally
327
+ ===================
328
+ For now, e2e tests only covers proxy and ssl testing. We are expected to broaden our e2e tests to other scenarios moving forward.
329
+ To add more e2e tests, put these in the `../tests/e2e` folder.
330
+
331
+ ## Preparation
332
+ - Create virtual environment.
333
+ ```bash
334
+ python3 -m venv venv
335
+ ```
336
+
337
+ - Activate virtual environment
338
+ ```bash
339
+ source venv/bin/activate
340
+ ```
341
+
342
+ - Install dependencies.
343
+ ```bash
344
+ pip install -r requirements/development.txt
345
+ ```
346
+
347
+ - From the python_api project root directory, install the package.
348
+ ```bash
349
+ pip install -e .
350
+ ```
351
+
352
+ - Export api credentials to use.
353
+ ```bash
354
+ export TEST_USER=<user-key>
355
+ export TEST_KEY=<api-key>
356
+ ```
357
+
358
+ ## Run the end-to-end test script
359
+ - Before running the test, be sure that docker is running.
360
+ - Execute the e2e test script .
361
+ ```bash
362
+ sh tests/e2e/scripts/test_e2e_runner.sh
363
+ ```
@@ -342,11 +342,20 @@ def test_exception_handling():
342
342
  API("notauser", "notakey").domain_search("amazon").data()
343
343
  with pytest.raises(
344
344
  ValueError,
345
- match=r"Invalid value 'notahash' for 'key_sign_hash'. Values available are sha1,sha256,md5",
345
+ match=r"Invalid value 'notahash' for 'key_sign_hash'. Values available are sha1,sha256",
346
346
  ):
347
347
  API("notauser", "notakey", always_sign_api_key=True, key_sign_hash="notahash").domain_search("amazon")
348
348
 
349
349
 
350
+ @vcr.use_cassette
351
+ def test_md5_is_not_supported():
352
+ with pytest.raises(
353
+ ValueError,
354
+ match=r"Invalid value 'md5' for 'key_sign_hash'. Values available are sha1,sha256",
355
+ ):
356
+ API("notauser", "notakey", always_sign_api_key=True, key_sign_hash="md5").domain_search("amazon")
357
+
358
+
350
359
  @vcr.use_cassette
351
360
  def test_rate_limiting():
352
361
  domain_searches = ["google"] * 31
@@ -377,6 +386,7 @@ def test_formats():
377
386
 
378
387
 
379
388
  @vcr.use_cassette
389
+ @pytest.mark.skip(reason="Iris endpoint is already deprecated in light of enrich and investigate")
380
390
  def test_iris():
381
391
  with pytest.raises(ValueError):
382
392
  api.iris()
@@ -1 +0,0 @@
1
- 2.4.1