esuls 0.2.2__tar.gz → 0.2.3__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 (31) hide show
  1. {esuls-0.2.2/src/esuls.egg-info → esuls-0.2.3}/PKG-INFO +1 -1
  2. {esuls-0.2.2 → esuls-0.2.3}/pyproject.toml +1 -1
  3. {esuls-0.2.2 → esuls-0.2.3}/src/esuls/request_cli.py +24 -2
  4. {esuls-0.2.2 → esuls-0.2.3/src/esuls.egg-info}/PKG-INFO +1 -1
  5. {esuls-0.2.2 → esuls-0.2.3}/LICENSE +0 -0
  6. {esuls-0.2.2 → esuls-0.2.3}/README.md +0 -0
  7. {esuls-0.2.2 → esuls-0.2.3}/setup.cfg +0 -0
  8. {esuls-0.2.2 → esuls-0.2.3}/src/esuls/__init__.py +0 -0
  9. {esuls-0.2.2 → esuls-0.2.3}/src/esuls/db_cli.py +0 -0
  10. {esuls-0.2.2 → esuls-0.2.3}/src/esuls/download_icon.py +0 -0
  11. {esuls-0.2.2 → esuls-0.2.3}/src/esuls/pdf/__init__.py +0 -0
  12. {esuls-0.2.2 → esuls-0.2.3}/src/esuls/pdf/checker.py +0 -0
  13. {esuls-0.2.2 → esuls-0.2.3}/src/esuls/pdf/cli.py +0 -0
  14. {esuls-0.2.2 → esuls-0.2.3}/src/esuls/pdf/inspect.py +0 -0
  15. {esuls-0.2.2 → esuls-0.2.3}/src/esuls/pdf/metadata.py +0 -0
  16. {esuls-0.2.2 → esuls-0.2.3}/src/esuls/tests/_common.py +0 -0
  17. {esuls-0.2.2 → esuls-0.2.3}/src/esuls/tests/conftest.py +0 -0
  18. {esuls-0.2.2 → esuls-0.2.3}/src/esuls/tests/test_cross_loop.py +0 -0
  19. {esuls-0.2.2 → esuls-0.2.3}/src/esuls/tests/test_db_advanced.py +0 -0
  20. {esuls-0.2.2 → esuls-0.2.3}/src/esuls/tests/test_db_concurrent.py +0 -0
  21. {esuls-0.2.2 → esuls-0.2.3}/src/esuls/tests/test_db_fixes.py +0 -0
  22. {esuls-0.2.2 → esuls-0.2.3}/src/esuls/tests/test_db_migrations.py +0 -0
  23. {esuls-0.2.2 → esuls-0.2.3}/src/esuls/tests/test_db_sqla.py +0 -0
  24. {esuls-0.2.2 → esuls-0.2.3}/src/esuls/tests/test_pdf.py +0 -0
  25. {esuls-0.2.2 → esuls-0.2.3}/src/esuls/tests/test_request_cli.py +0 -0
  26. {esuls-0.2.2 → esuls-0.2.3}/src/esuls/utils.py +0 -0
  27. {esuls-0.2.2 → esuls-0.2.3}/src/esuls.egg-info/SOURCES.txt +0 -0
  28. {esuls-0.2.2 → esuls-0.2.3}/src/esuls.egg-info/dependency_links.txt +0 -0
  29. {esuls-0.2.2 → esuls-0.2.3}/src/esuls.egg-info/entry_points.txt +0 -0
  30. {esuls-0.2.2 → esuls-0.2.3}/src/esuls.egg-info/requires.txt +0 -0
  31. {esuls-0.2.2 → esuls-0.2.3}/src/esuls.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: esuls
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: Utility library for async database operations, HTTP requests, and parallel execution
5
5
  Author-email: IperGiove <ipergiove@gmail.com>
6
6
  License: MIT
@@ -7,7 +7,7 @@ esuls-pdf = "esuls.pdf.cli:app"
7
7
 
8
8
  [project]
9
9
  name = "esuls"
10
- version = "0.2.2"
10
+ version = "0.2.3"
11
11
  description = "Utility library for async database operations, HTTP requests, and parallel execution"
12
12
  readme = "README.md"
13
13
  requires-python = ">=3.14"
@@ -876,6 +876,27 @@ async def make_request_playwright(
876
876
  await stealth_async(page)
877
877
  page.set_default_timeout(timeout_request * 1000)
878
878
 
879
+ # Track the final main-frame document response. JS cookie
880
+ # challenges (Sucuri CloudProxy, some Cloudflare/HSTS 307s)
881
+ # answer the first request with a 307 + a script that sets a
882
+ # cookie and calls location.reload(); the real page then loads
883
+ # with a fresh 200. page.goto() only returns that first
884
+ # response (the 307), so we follow the main frame's last
885
+ # navigation response to report the status/headers of the
886
+ # document actually rendered.
887
+ final_doc: dict = {"resp": None}
888
+
889
+ def _track_main_doc(r):
890
+ try:
891
+ if (r.request.is_navigation_request()
892
+ and r.frame is page.main_frame):
893
+ final_doc["resp"] = r
894
+ except Exception:
895
+ # Frame/request may already be torn down mid-event.
896
+ pass
897
+
898
+ page.on("response", _track_main_doc)
899
+
879
900
  resp = await page.goto(url, wait_until="domcontentloaded")
880
901
  # Wait for network activity to settle (more robust than a fixed
881
902
  # sleep for SPAs). Bounded by `wait_seconds` so pages with
@@ -894,13 +915,14 @@ async def make_request_playwright(
894
915
  f"networkidle wait expired, proceeding: {wait_err}"
895
916
  )
896
917
 
918
+ doc_resp = final_doc["resp"] or resp
897
919
  page_source = await page.content()
898
920
  final_url = page.url
899
- status_code = resp.status if resp else 200
921
+ status_code = doc_resp.status if doc_resp else 200
900
922
 
901
923
  response = Response(
902
924
  status_code=status_code,
903
- headers=dict(resp.headers) if resp else {},
925
+ headers=dict(doc_resp.headers) if doc_resp else {},
904
926
  _content=page_source.encode("utf-8"),
905
927
  text=page_source,
906
928
  url=final_url,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: esuls
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: Utility library for async database operations, HTTP requests, and parallel execution
5
5
  Author-email: IperGiove <ipergiove@gmail.com>
6
6
  License: MIT
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes