I'm using Docusign API to gather monthly sent envelopes for reporting usign python.
Here's my code:
configuration = Configuration()
configuration.host = "https://demo.docusign.net/restapi"
configuration.api_key = {
"X-DocuSign-Authentication": f'<DocuSignCredentials><Username>{api_username}</Username><Password>{api_password}</Password><IntegratorKey>{integrator_key}</IntegratorKey></DocuSignCredentials>'
}
api_client = ApiClient(configuration)
envelopes_api = EnvelopesApi(api_client)
base_url = configuration.host
try:
profile_id = input("Enter profile ID : ")
now = datetime.now()
first_day_of_last_month = (now.replace(day=1) - timedelta(days=1)).replace(day=1)
last_day_of_last_month = (now.replace(day=1) - timedelta(days=1)).replace(day=calendar.monthrange(now.year, now.month - 1)[1])
envelope_results = envelopes_api.list_status_changes(account_id=profile_id, from_date=first_day_of_last_month.strftime("%Y-%m-%dT%H:%M:%S"), to_date=last_day_of_last_month.strftime("%Y-%m-%dT%H:%M:%S"))
print("Envelopes from previous month :")
for envelope in envelope_results.envelopes:
print(f"ID : {envelope.envelope_id}, Statut : {envelope.status}, Créé le : {envelope.created_datetime}")
except Exception as e:
print(f"An error occured : {e}")
But I get "Unsupported operand type" on envelope_results. I've looked around for solutions but no chance. Need help. Thanks.
Google and official github and documentation reading
I don't know why you're getting "Unsupported operand type" (see my debugging section below) but I know for sure that you're not using OAuth to obtain an access code.
This line
configuration.api_key = {
"X-DocuSign-Authentication": f'<DocuSignCredentials><Username>{api_username}</Username><Password>{api_password}</Password><IntegratorKey>{integrator_key}</IntegratorKey></DocuSignCredentials>'
}
is not allowed for any new apps and should be updated for any current apps.
Get a network request/response trace. Docs. It will show you what your app is sending to Docusign.
If it isn't clear, Edit your question and add the network log