🐛 fix(GetRequest.py): update orjson_dumps function call to set indent_2 parameter to False
🐛 fix(GetRequest.py): update return type annotation of get_documents method to list[Document] 🐛 fix(PostRequest.py): update return type annotation of post_document method to list[Document]
This commit is contained in:
parent
6fa2258aac
commit
05c8f5a0f8
2 changed files with 5 additions and 5 deletions
|
|
@ -31,7 +31,7 @@ class GetRequest(CustomComponent):
|
|||
response = session.get(url, headers=headers, timeout=timeout)
|
||||
try:
|
||||
response_json = response.json()
|
||||
result = orjson_dumps(response_json, indent=2)
|
||||
result = orjson_dumps(response_json, indent_2=False)
|
||||
except Exception:
|
||||
result = response.text
|
||||
self.repr_value = result
|
||||
|
|
@ -59,11 +59,11 @@ class GetRequest(CustomComponent):
|
|||
url: str,
|
||||
headers: Optional[dict] = None,
|
||||
timeout: int = 5,
|
||||
) -> Document:
|
||||
) -> list[Document]:
|
||||
if headers is None:
|
||||
headers = {}
|
||||
if not isinstance(url, list):
|
||||
url = [url]
|
||||
url: list[str] = [url]
|
||||
with requests.Session() as session:
|
||||
documents = [self.get_document(session, u, headers, timeout) for u in url]
|
||||
self.repr_value = documents
|
||||
|
|
|
|||
|
|
@ -59,12 +59,12 @@ class PostRequest(CustomComponent):
|
|||
document: Document,
|
||||
url: str,
|
||||
headers: Optional[dict] = None,
|
||||
) -> Document:
|
||||
) -> list[Document]:
|
||||
if headers is None:
|
||||
headers = {}
|
||||
|
||||
if not isinstance(document, list) and isinstance(document, Document):
|
||||
document = [document]
|
||||
document: list[Document] = [document]
|
||||
else:
|
||||
raise ValueError("document must be a Document or a list of Documents")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue