使用python3调用C语言的libWeWorkFinanceSdk_C.so,一直报错如下:
相关代码:
import base64
import ctypes
from ctypes import *
import json
from Crypto.Cipher import PKCS1_v1_5
from Crypto.PublicKey import RSA
class Slice_t(Structure):
_fields_ = [
("buf",ctypes.c_char_p),
("len",ctypes.c_int),
]
class MediaData_t(Structure):
_fields_ = [
("outindexbuf", ctypes.c_char_p),
("out_len", ctypes.c_int),
("data", ctypes.c_char_p),
("data_len", ctypes.c_int),
("is_finish", ctypes.c_int),
]
d = cdll.LoadLibrary('./libWeWorkFinanceSdk_C.so')
appid = 'wxxxxxxxxxxxb'
s = "dYf12xxxxxxxxxxxxxxxxxxxxxxxzzhpSYoJxx"
r= d.NewSdk()
NewDKey = d.Init(r,appid,s)
slice = Slice_t()
tes2 = d.GetChatData(r,0,100,"","",2,ctypes.byref(slice))
res = slice.buf
data = json.loads(res)
print(data)
{'errcode': 41001, 'errmsg': 'access_token missing, hint: [1620463281_108_313a28b8b986526a909584a121797653], from ip: 183.63.212.6, more info at https://open.work.weixin.qq.com/devtool/query?e=41001', 'chatdata'
# 已经确保corpid和secret是正确的。但是一直还是报错这个
你好,请问有调用sdk的init和init成功了么,是否是按照demo进行调用的,可能是python调用c库的时候有问题