har2tree 1.36.3__py3-none-any.whl → 1.36.4__py3-none-any.whl

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.
har2tree/har2tree.py CHANGED
@@ -250,7 +250,7 @@ class HarFile():
250
250
  @property
251
251
  def root_url(self) -> str:
252
252
  """First URL of the capture"""
253
- return self.entries[0]['request']['url']
253
+ return self.entries[0]['request']['url'].strip()
254
254
 
255
255
  def __find_header_value(self, har_entry: dict[str, Any], header_name: str) -> str | None:
256
256
  """Get the value of a specific header"""
har2tree/nodes.py CHANGED
@@ -25,7 +25,7 @@ import json_stream # type: ignore
25
25
 
26
26
  from bs4 import BeautifulSoup
27
27
  from ete3 import TreeNode # type: ignore
28
- from pyfaup import Url, Hostname
28
+ from pyfaup import Url, Host
29
29
  from requests_toolbelt.multipart import decoder # type: ignore
30
30
  from w3lib.html import strip_html5_whitespace
31
31
  from w3lib.url import canonicalize_url, safe_url_string
@@ -711,12 +711,18 @@ class HostNode(HarTreeNode):
711
711
  if hasattr(self, 'hostname_is_ip') or hasattr(self, 'file_on_disk'):
712
712
  return None
713
713
  try:
714
- faup_hostname = Hostname(self.name)
714
+ faup_host = Host(self.name)
715
+ if not faup_host.is_hostname():
716
+ return None
717
+ faup_hostname = faup_host.try_into_hostname()
715
718
  if faup_hostname.domain:
716
719
  return str(faup_hostname.domain)
717
720
 
718
721
  self.logger.warning(f'No domain: "{self.name}"')
719
722
  return None
723
+ except ValueError as e:
724
+ self.logger.warning(f'Not a Host "{self.name}": {e}')
725
+ return None
720
726
  except Exception as e:
721
727
  self.logger.warning(f'Unable to parse Hostname "{self.name}": {e}')
722
728
  return None
@@ -726,12 +732,18 @@ class HostNode(HarTreeNode):
726
732
  if hasattr(self, 'hostname_is_ip') or hasattr(self, 'file_on_disk'):
727
733
  return None
728
734
  try:
729
- faup_hostname = Hostname(self.name)
735
+ faup_host = Host(self.name)
736
+ if not faup_host.is_hostname():
737
+ return None
738
+ faup_hostname = faup_host.try_into_hostname()
730
739
  if faup_hostname.suffix:
731
740
  return str(faup_hostname.suffix)
732
741
 
733
742
  self.logger.warning(f'No domain: "{self.name}"')
734
743
  return None
744
+ except ValueError as e:
745
+ self.logger.warning(f'Not a Host "{self.name}": {e}')
746
+ return None
735
747
  except Exception as e:
736
748
  self.logger.warning(f'Unable to parse Hostname "{self.name}": {e}')
737
749
  return None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: har2tree
3
- Version: 1.36.3
3
+ Version: 1.36.4
4
4
  Summary: HTTP Archive (HAR) to ETE Toolkit generator
5
5
  License-Expression: BSD-3-Clause
6
6
  License-File: LICENSE
@@ -29,7 +29,7 @@ Requires-Dist: multipart (>=1.3.0,<2.0.0)
29
29
  Requires-Dist: numpy (>=2.2,<2.3) ; python_version < "3.11"
30
30
  Requires-Dist: numpy (>=2.4.2) ; python_version >= "3.11" and python_version < "4.0"
31
31
  Requires-Dist: pure-magic-rs (>=0.3.1,<0.4.0)
32
- Requires-Dist: pyfaup-rs (>=0.2.1,<0.3.0)
32
+ Requires-Dist: pyfaup-rs (>=0.3,<0.4.0)
33
33
  Requires-Dist: requests-toolbelt (>=1.0.0,<2.0.0)
34
34
  Requires-Dist: six (>=1.17.0) ; extra == "docs"
35
35
  Requires-Dist: tinycss2 (>=1.5.1)
@@ -0,0 +1,10 @@
1
+ har2tree/__init__.py,sha256=Na3mxHkUBq3rzYbxiLNJF37DxH5mcghSorjzXw5Teug,422
2
+ har2tree/har2tree.py,sha256=NgmI1aPus_IY-7KgTF2Ju80h6Giwq7lTLquItzrkSu8,54298
3
+ har2tree/helper.py,sha256=3_KatDaP7pqglD1MAmPTYGARxubi3x3y4Ia2FpbX9sw,20731
4
+ har2tree/nodes.py,sha256=ft2NimyTkVm-aP9F9ZipXnlOH9dC_mw8uo5VOzYBCNc,39978
5
+ har2tree/parser.py,sha256=4yej1OcVYAIiLfzYZsO9WCw3WyM_ykDTuvpW7UO1ROE,3645
6
+ har2tree/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ har2tree-1.36.4.dist-info/METADATA,sha256=4O4K-3l-kXyozixHkAICVSWylm2_JzgOnfCRjbg_QQw,2240
8
+ har2tree-1.36.4.dist-info/WHEEL,sha256=kJCRJT_g0adfAJzTx2GUMmS80rTJIVHRCfG0DQgLq3o,88
9
+ har2tree-1.36.4.dist-info/licenses/LICENSE,sha256=Xa4EVROgJsEo10CW-ISCRiw0TtqdKz1JuM3BBLBM55c,1803
10
+ har2tree-1.36.4.dist-info/RECORD,,
@@ -1,10 +0,0 @@
1
- har2tree/__init__.py,sha256=Na3mxHkUBq3rzYbxiLNJF37DxH5mcghSorjzXw5Teug,422
2
- har2tree/har2tree.py,sha256=TVC122tJ6PmNV8Rim0j__vmPo3a1ikCL-PmYfy0WlRo,54290
3
- har2tree/helper.py,sha256=3_KatDaP7pqglD1MAmPTYGARxubi3x3y4Ia2FpbX9sw,20731
4
- har2tree/nodes.py,sha256=hkcEwyu_5aydla0aQbix795hHx9MOaSSQ0VcPNKFsKE,39494
5
- har2tree/parser.py,sha256=4yej1OcVYAIiLfzYZsO9WCw3WyM_ykDTuvpW7UO1ROE,3645
6
- har2tree/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
- har2tree-1.36.3.dist-info/METADATA,sha256=mEm0GRhHcbKmrcw-AkbZLG1H67WoOthlFwG1K8puUC0,2242
8
- har2tree-1.36.3.dist-info/WHEEL,sha256=kJCRJT_g0adfAJzTx2GUMmS80rTJIVHRCfG0DQgLq3o,88
9
- har2tree-1.36.3.dist-info/licenses/LICENSE,sha256=Xa4EVROgJsEo10CW-ISCRiw0TtqdKz1JuM3BBLBM55c,1803
10
- har2tree-1.36.3.dist-info/RECORD,,