parsagon 0.14.24__tar.gz → 0.14.26__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 (38) hide show
  1. {parsagon-0.14.24 → parsagon-0.14.26}/PKG-INFO +3 -2
  2. {parsagon-0.14.24 → parsagon-0.14.26}/pyproject.toml +3 -2
  3. {parsagon-0.14.24 → parsagon-0.14.26}/src/parsagon/api.py +2 -1
  4. {parsagon-0.14.24 → parsagon-0.14.26}/src/parsagon/executor.py +35 -0
  5. {parsagon-0.14.24 → parsagon-0.14.26}/src/parsagon/main.py +5 -0
  6. {parsagon-0.14.24 → parsagon-0.14.26}/src/parsagon/runs.py +2 -1
  7. {parsagon-0.14.24 → parsagon-0.14.26}/src/parsagon.egg-info/PKG-INFO +3 -2
  8. {parsagon-0.14.24 → parsagon-0.14.26}/src/parsagon.egg-info/requires.txt +2 -1
  9. {parsagon-0.14.24 → parsagon-0.14.26}/README.md +0 -0
  10. {parsagon-0.14.24 → parsagon-0.14.26}/setup.cfg +0 -0
  11. {parsagon-0.14.24 → parsagon-0.14.26}/src/__init__.py +0 -0
  12. {parsagon-0.14.24 → parsagon-0.14.26}/src/parsagon/__init__.py +0 -0
  13. {parsagon-0.14.24 → parsagon-0.14.26}/src/parsagon/assistant.py +0 -0
  14. {parsagon-0.14.24 → parsagon-0.14.26}/src/parsagon/create.py +0 -0
  15. {parsagon-0.14.24 → parsagon-0.14.26}/src/parsagon/custom_function.py +0 -0
  16. {parsagon-0.14.24 → parsagon-0.14.26}/src/parsagon/edit.py +0 -0
  17. {parsagon-0.14.24 → parsagon-0.14.26}/src/parsagon/exceptions.py +0 -0
  18. {parsagon-0.14.24 → parsagon-0.14.26}/src/parsagon/gui/__init__.py +0 -0
  19. {parsagon-0.14.24 → parsagon-0.14.26}/src/parsagon/gui/controller.py +0 -0
  20. {parsagon-0.14.24 → parsagon-0.14.26}/src/parsagon/gui/menu.py +0 -0
  21. {parsagon-0.14.24 → parsagon-0.14.26}/src/parsagon/gui/window.py +0 -0
  22. {parsagon-0.14.24 → parsagon-0.14.26}/src/parsagon/gui_entry.py +0 -0
  23. {parsagon-0.14.24 → parsagon-0.14.26}/src/parsagon/highlights.js +0 -0
  24. {parsagon-0.14.24 → parsagon-0.14.26}/src/parsagon/print.py +0 -0
  25. {parsagon-0.14.24 → parsagon-0.14.26}/src/parsagon/secrets.py +0 -0
  26. {parsagon-0.14.24 → parsagon-0.14.26}/src/parsagon/settings.py +0 -0
  27. {parsagon-0.14.24 → parsagon-0.14.26}/src/parsagon/tests/__init__.py +0 -0
  28. {parsagon-0.14.24 → parsagon-0.14.26}/src/parsagon/tests/api_mocks.py +0 -0
  29. {parsagon-0.14.24 → parsagon-0.14.26}/src/parsagon/tests/conftest.py +0 -0
  30. {parsagon-0.14.24 → parsagon-0.14.26}/src/parsagon/tests/test_executor.py +0 -0
  31. {parsagon-0.14.24 → parsagon-0.14.26}/src/parsagon/tests/test_invalid_args.py +0 -0
  32. {parsagon-0.14.24 → parsagon-0.14.26}/src/parsagon/tests/test_pipeline_operations.py +0 -0
  33. {parsagon-0.14.24 → parsagon-0.14.26}/src/parsagon/tests/test_print.py +0 -0
  34. {parsagon-0.14.24 → parsagon-0.14.26}/src/parsagon/tests/test_secrets.py +0 -0
  35. {parsagon-0.14.24 → parsagon-0.14.26}/src/parsagon.egg-info/SOURCES.txt +0 -0
  36. {parsagon-0.14.24 → parsagon-0.14.26}/src/parsagon.egg-info/dependency_links.txt +0 -0
  37. {parsagon-0.14.24 → parsagon-0.14.26}/src/parsagon.egg-info/entry_points.txt +0 -0
  38. {parsagon-0.14.24 → parsagon-0.14.26}/src/parsagon.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: parsagon
3
- Version: 0.14.24
3
+ Version: 0.14.26
4
4
  Summary: Allows you to create browser automations with natural language
5
5
  Author-email: Sandy Suh <sandy@parsagon.io>
6
6
  Project-URL: Homepage, https://parsagon.io
@@ -16,10 +16,11 @@ Requires-Dist: rich==13.6.0
16
16
  Requires-Dist: PyVirtualDisplay==3.0
17
17
  Requires-Dist: selenium-wire==5.1.0
18
18
  Requires-Dist: cssselect==1.1.0
19
- Requires-Dist: undetected-chromedriver==3.5.3
19
+ Requires-Dist: undetected-chromedriver==3.5.5
20
20
  Requires-Dist: webdriver-manager==4.0.1
21
21
  Requires-Dist: jsonpath-ng==1.5.3
22
22
  Requires-Dist: simplejson==3.19.1
23
+ Requires-Dist: pypdf==4.2.0
23
24
  Provides-Extra: dev
24
25
  Requires-Dist: pytest==7.3.2; extra == "dev"
25
26
  Requires-Dist: pytest-mock==3.11.1; extra == "dev"
@@ -16,7 +16,7 @@ line-length = 120
16
16
 
17
17
  [project]
18
18
  name = "parsagon"
19
- version = "0.14.24"
19
+ version = "0.14.26"
20
20
  description = "Allows you to create browser automations with natural language"
21
21
  readme = "README.md"
22
22
  requires-python = ">=3.8"
@@ -39,10 +39,11 @@ dependencies = [
39
39
  'PyVirtualDisplay==3.0',
40
40
  'selenium-wire==5.1.0',
41
41
  'cssselect==1.1.0',
42
- 'undetected-chromedriver==3.5.3',
42
+ 'undetected-chromedriver==3.5.5',
43
43
  'webdriver-manager==4.0.1',
44
44
  'jsonpath-ng==1.5.3',
45
45
  'simplejson==3.19.1',
46
+ 'pypdf==4.2.0',
46
47
  ]
47
48
 
48
49
  [project.optional-dependencies]
@@ -235,7 +235,7 @@ def get_pipelines():
235
235
  return _api_call(httpx.get, f"/pipelines/")
236
236
 
237
237
 
238
- def get_pipeline_code(pipeline_name, variables, headless, use_uc, optimize):
238
+ def get_pipeline_code(pipeline_name, variables, headless, use_uc, optimize, use_proxy):
239
239
  escaped_pipeline_name = double_quote(pipeline_name)
240
240
  with RaiseProgramNotFound(pipeline_name):
241
241
  return _api_call(
@@ -246,6 +246,7 @@ def get_pipeline_code(pipeline_name, variables, headless, use_uc, optimize):
246
246
  "headless": headless,
247
247
  "use_uc": use_uc,
248
248
  "optimize": optimize,
249
+ "use_proxy": use_proxy,
249
250
  },
250
251
  )
251
252
 
@@ -1,13 +1,16 @@
1
1
  from collections import defaultdict
2
2
  import copy
3
+ import glob
3
4
  import json
4
5
  import logging
6
+ import os
5
7
  from pathlib import Path
6
8
  import psutil
7
9
  import time
8
10
  from urllib.parse import urljoin
9
11
 
10
12
  import lxml.html
13
+ from pypdf import PdfReader
11
14
  from pyvirtualdisplay import Display
12
15
  import undetected_chromedriver as uc
13
16
  from selenium import webdriver
@@ -92,12 +95,30 @@ class Executor:
92
95
  chrome_options.add_argument("--start-maximized")
93
96
  for option in options:
94
97
  chrome_options.add_argument(option)
98
+ chrome_options.add_experimental_option(
99
+ "prefs",
100
+ {
101
+ "download.default_directory": os.getcwd(),
102
+ "download.prompt_for_download": False,
103
+ "download.directory_upgrade": True,
104
+ "plugins.always_open_pdf_externally": True,
105
+ },
106
+ )
95
107
  self.driver = uc.Chrome(driver_executable_path=driver_executable_path, options=chrome_options)
96
108
  else:
97
109
  chrome_options = webdriver.ChromeOptions()
98
110
  chrome_options.add_argument("--start-maximized")
99
111
  for option in options:
100
112
  chrome_options.add_argument(option)
113
+ chrome_options.add_experimental_option(
114
+ "prefs",
115
+ {
116
+ "download.default_directory": os.getcwd(),
117
+ "download.prompt_for_download": False,
118
+ "download.directory_upgrade": True,
119
+ "plugins.always_open_pdf_externally": True,
120
+ },
121
+ )
101
122
  self.driver = webdriver.Chrome(service=ChromeService(driver_executable_path), options=chrome_options)
102
123
  if page_load_timeout:
103
124
  self.driver.set_page_load_timeout(page_load_timeout)
@@ -124,6 +145,7 @@ class Executor:
124
145
  "get_str_about_data": get_str_about_data,
125
146
  "get_bool_about_data": get_bool_about_data,
126
147
  "get_json_about_data": get_json_about_data,
148
+ "get_pdf_text": self.get_pdf_text,
127
149
  }
128
150
  self.custom_functions = {}
129
151
  self.infer = infer
@@ -617,6 +639,19 @@ class Executor:
617
639
  self.add_custom_function(call_id, custom_function)
618
640
  return scraped_data
619
641
 
642
+ def get_pdf_text(self, url):
643
+ window_id = self.goto(url)
644
+ self.close_window(window_id)
645
+ files = glob.glob("*")
646
+ most_recent_file = max(files, key=os.path.getmtime)
647
+ reader = PdfReader(most_recent_file)
648
+ text = ""
649
+ for page in reader.pages:
650
+ text += page.extract_text(extraction_mode="layout", layout_mode_space_vertically=False)
651
+ text += "\n"
652
+ os.remove(most_recent_file)
653
+ return text
654
+
620
655
  def execute(self, code):
621
656
  loc = {}
622
657
  try:
@@ -142,6 +142,11 @@ def get_args(argv):
142
142
  action="store_true",
143
143
  help="run in optimized mode",
144
144
  )
145
+ parser_run.add_argument(
146
+ "--use_proxy",
147
+ action="store_true",
148
+ help="run with proxy",
149
+ )
145
150
  parser_run.set_defaults(func=run)
146
151
 
147
152
  # Delete
@@ -29,6 +29,7 @@ def run(
29
29
  output_file=None,
30
30
  undetected=False,
31
31
  optimize=False,
32
+ use_proxy=False,
32
33
  verbose=False,
33
34
  ):
34
35
  """
@@ -80,7 +81,7 @@ def run(
80
81
  time.sleep(5)
81
82
 
82
83
  run = create_pipeline_run(pipeline_id, variables, True)
83
- code = get_pipeline_code(program_name, variables, headless, undetected, optimize)["code"]
84
+ code = get_pipeline_code(program_name, variables, headless, undetected, optimize, use_proxy)["code"]
84
85
  start_time = datetime.datetime.now(datetime.timezone.utc).isoformat()
85
86
  run_data = {"start_time": start_time}
86
87
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: parsagon
3
- Version: 0.14.24
3
+ Version: 0.14.26
4
4
  Summary: Allows you to create browser automations with natural language
5
5
  Author-email: Sandy Suh <sandy@parsagon.io>
6
6
  Project-URL: Homepage, https://parsagon.io
@@ -16,10 +16,11 @@ Requires-Dist: rich==13.6.0
16
16
  Requires-Dist: PyVirtualDisplay==3.0
17
17
  Requires-Dist: selenium-wire==5.1.0
18
18
  Requires-Dist: cssselect==1.1.0
19
- Requires-Dist: undetected-chromedriver==3.5.3
19
+ Requires-Dist: undetected-chromedriver==3.5.5
20
20
  Requires-Dist: webdriver-manager==4.0.1
21
21
  Requires-Dist: jsonpath-ng==1.5.3
22
22
  Requires-Dist: simplejson==3.19.1
23
+ Requires-Dist: pypdf==4.2.0
23
24
  Provides-Extra: dev
24
25
  Requires-Dist: pytest==7.3.2; extra == "dev"
25
26
  Requires-Dist: pytest-mock==3.11.1; extra == "dev"
@@ -6,10 +6,11 @@ rich==13.6.0
6
6
  PyVirtualDisplay==3.0
7
7
  selenium-wire==5.1.0
8
8
  cssselect==1.1.0
9
- undetected-chromedriver==3.5.3
9
+ undetected-chromedriver==3.5.5
10
10
  webdriver-manager==4.0.1
11
11
  jsonpath-ng==1.5.3
12
12
  simplejson==3.19.1
13
+ pypdf==4.2.0
13
14
 
14
15
  [dev]
15
16
  pytest==7.3.2
File without changes
File without changes
File without changes