When using the SDK to send documents, an error is raised if "expiration_date" is None. This does not occur when using the requests library.
Example with SDK:
import pandadoc_client
from pandadoc_client.api import documents_api
from pandadoc_client.model.document_send_request import DocumentSendRequest
API_KEY = ""
DOCUMENT_ID = ""
cfg = pandadoc_client.Configuration(
api_key={"apiKey": f"API-Key {API_KEY}"}"},
)
client = pandadoc_client.ApiClient(cfg)
documents_instance = documents_api.DocumentsApi(client)
document_send_request = DocumentSendRequest(silent=False, subject="This doc was sent via python SDK")
documents_instance.send_document(DOCUMENT_ID, document_send_request=document_send_request)
Raises:
pandadoc_client.exceptions.ApiTypeError: Invalid type for variable 'expiration_date'. Required value type is str and passed type was NoneType at ['received_data']['expiration_date']
Example with GET:
import requests
API_KEY = ""
DOCUMENT_ID = "" # same template as the previous example
headers = {
"Content-Type": "application/json",
"Authorization": f"API-Key {API_KEY}"
}
url = "https://api.pandadoc.com/" + f"public/v1/documents/{DOCUMENT_ID}/send"
res = requests.get(url, headers=headers)
document_sent_response_dict = res.json()
Impact:
Because of this library behavior, I can't implement the feature of sending the document to the set of recipients defined during its creation using the SDK. Even though they receive the document, the method throws the below error:
{
"message": "An unexpected error occurred.",
"errors": "Invalid type for variable 'expiration_date'. Required value type is str and passed type was NoneType at ['received_data']['expiration_date']"
}
Steps to Reproduce:
Set up the PandaDoc Python SDK using the API key and document ID.
Create a document using a reference template with a set of recipients and send it with "expiration_date" as None, as it can't be set using the SDK.
Observe the error raised by the SDK.
Expected Behavior:
The SDK should handle None values for fields that might be unknown or optional, similar to the behavior when using the requests library.
Actual Behavior:
The SDK raises an error when encountering None values for "expiration_date".
Environment:
Operating System: Ubuntu 20.04
Python Version: 3.11
PandaDoc Python SDK Version: 6.2.0
Additional Context: Handling None values gracefully in the SDK would improve its usability and prevent unexpected errors, aligning its behavior with direct API calls using the requests library.
When using the SDK to send documents, an error is raised if "expiration_date" is None. This does not occur when using the
requests
library.Example with SDK:
Raises:
Example with GET:
Impact:
Because of this library behavior, I can't implement the feature of sending the document to the set of recipients defined during its creation using the SDK. Even though they receive the document, the method throws the below error:
Steps to Reproduce:
Expected Behavior:
The SDK should handle None values for fields that might be unknown or optional, similar to the behavior when using the requests library.
Actual Behavior:
The SDK raises an error when encountering None values for "expiration_date".
Environment:
requests
library.