我正在使用 Docusign API 收集每月发送的信封以报告使用 python 的情况。
这是我的代码:
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}")
但是我在信封结果上收到“不支持的操作数类型”。 我已经四处寻找解决方案,但没有机会。 需要帮忙。 谢谢。
Google和官方github以及文档阅读
我不知道为什么您会收到“不支持的操作数类型”(请参阅下面的调试部分),但我确信您没有使用 OAuth 来获取访问代码。
这条线
configuration.api_key = {
"X-DocuSign-Authentication": f'<DocuSignCredentials><Username>{api_username}</Username><Password>{api_password}</Password><IntegratorKey>{integrator_key}</IntegratorKey></DocuSignCredentials>'
}
不允许任何新应用程序使用,应针对任何当前应用程序进行更新。
获取网络请求/响应跟踪。 文档。它将向您显示您的应用程序正在发送到 Docusign 的内容。
如果不清楚,编辑您的问题并添加网络日志