simplex 1.2.53__tar.gz → 1.2.55__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.
Potentially problematic release.
This version of simplex might be problematic. Click here for more details.
- {simplex-1.2.53 → simplex-1.2.55}/PKG-INFO +1 -1
- {simplex-1.2.53 → simplex-1.2.55}/setup.py +1 -1
- {simplex-1.2.53 → simplex-1.2.55}/simplex/simplex.py +23 -10
- {simplex-1.2.53 → simplex-1.2.55}/simplex.egg-info/PKG-INFO +1 -1
- {simplex-1.2.53 → simplex-1.2.55}/simplex.egg-info/SOURCES.txt +0 -1
- simplex-1.2.53/simplex/setup.py +0 -1
- {simplex-1.2.53 → simplex-1.2.55}/LICENSE +0 -0
- {simplex-1.2.53 → simplex-1.2.55}/README.md +0 -0
- {simplex-1.2.53 → simplex-1.2.55}/setup.cfg +0 -0
- {simplex-1.2.53 → simplex-1.2.55}/simplex/__init__.py +0 -0
- {simplex-1.2.53 → simplex-1.2.55}/simplex/cli.py +0 -0
- {simplex-1.2.53 → simplex-1.2.55}/simplex/deploy/__init__.py +0 -0
- {simplex-1.2.53 → simplex-1.2.55}/simplex/deploy/push.py +0 -0
- {simplex-1.2.53 → simplex-1.2.55}/simplex.egg-info/dependency_links.txt +0 -0
- {simplex-1.2.53 → simplex-1.2.55}/simplex.egg-info/entry_points.txt +0 -0
- {simplex-1.2.53 → simplex-1.2.55}/simplex.egg-info/requires.txt +0 -0
- {simplex-1.2.53 → simplex-1.2.55}/simplex.egg-info/top_level.txt +0 -0
- {simplex-1.2.53 → simplex-1.2.55}/tests/test.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import requests
|
|
2
2
|
import atexit
|
|
3
|
-
from typing import Optional
|
|
3
|
+
from typing import Optional, Union
|
|
4
4
|
import os
|
|
5
5
|
import json
|
|
6
6
|
import warnings
|
|
@@ -555,20 +555,33 @@ class Simplex:
|
|
|
555
555
|
else:
|
|
556
556
|
raise ValueError(f"Failed to restore login session: {response.json()['error']}")
|
|
557
557
|
|
|
558
|
-
def click_and_upload(self, element_description: str,
|
|
558
|
+
def click_and_upload(self, element_description: str, file_path_or_callable: Union[str, callable]):
|
|
559
|
+
"""
|
|
560
|
+
Args:
|
|
561
|
+
element_description: Description of the element to click and upload to
|
|
562
|
+
file_path_or_callable: Either a path to the file to be uploaded or a callable that returns a file-like object in 'rb' mode
|
|
563
|
+
"""
|
|
559
564
|
if not self.session_id:
|
|
560
565
|
raise ValueError(f"Must call create_session before calling action click_and_upload with element_description='{element_description}'")
|
|
561
|
-
|
|
562
|
-
files = {
|
|
563
|
-
'file': open(file_path, 'rb')
|
|
564
|
-
}
|
|
565
566
|
|
|
567
|
+
if not isinstance(file_path_or_callable, str) and not callable(file_path_or_callable):
|
|
568
|
+
raise TypeError("file_path_or_callable must be either a string or a callable, not a " + type(file_path_or_callable).__name__)
|
|
569
|
+
|
|
570
|
+
if isinstance(file_path_or_callable, str):
|
|
571
|
+
files = {
|
|
572
|
+
'file': open(file_path_or_callable, 'rb')
|
|
573
|
+
}
|
|
574
|
+
elif callable(file_path_or_callable):
|
|
575
|
+
files = {
|
|
576
|
+
'file': file_path_or_callable()
|
|
577
|
+
}
|
|
578
|
+
else:
|
|
579
|
+
raise ValueError("You must provide either a valid file path or a callable that returns a file-like object.")
|
|
566
580
|
data = {
|
|
567
|
-
'element_description': element_description
|
|
581
|
+
'element_description': element_description,
|
|
582
|
+
'session_id': self.session_id
|
|
568
583
|
}
|
|
569
584
|
|
|
570
|
-
data['session_id'] = self.session_id
|
|
571
|
-
|
|
572
585
|
response = requests.post(
|
|
573
586
|
f"{BASE_URL}/click_and_upload",
|
|
574
587
|
headers={
|
|
@@ -583,7 +596,7 @@ class Simplex:
|
|
|
583
596
|
return
|
|
584
597
|
else:
|
|
585
598
|
raise ValueError(f"Failed to click and upload: {response.json()['error']}")
|
|
586
|
-
|
|
599
|
+
|
|
587
600
|
def click_and_download(self, element_description: str):
|
|
588
601
|
if not self.session_id:
|
|
589
602
|
raise ValueError(f"Must call create_session before calling action click_and_download with element_description='{element_description}'")
|
simplex-1.2.53/simplex/setup.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
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
|