我一直在阅读有关如何更新用户自定义属性的文档.从如何编写,似乎我将能够做到以下几点:
email = "a@a.com"
results = service.users().list(domain="a.com",projection="full",query='email={0}'.format(email)).execute()
if len(results["users"]) == 1:
user = results["users"][0]
user["customSchemas"]["TEST"] = "TEST"
try:
userResponse = service.users().update(userKey=email, body=user).execute()
except HttpError, e:
print(e)
Run Code Online (Sandbox Code Playgroud)
但是,我抛出了错误:
https://www.googleapis.com/admin/directory/v1/users/test%40test.com?alt=json返回"未授权访问此资源/ api">
我不确定错误是因为我试图错误地更新字段,如果@url中的转义导致问题,或者我没有正确的范围(我正在使用https://www.googleapis.com/auth/admin.directory.user, https://www.googleapis.com/auth/admin.directory.domain, https://www.googleapis.com/auth/admin.directory.userschema).
如何为每个人创建自定义属性并使用python SDK为用户更新?
我有一个德里DLL暴露了一个具有以下签名的函数:
Function MyFunc(ObjID : Cardinal) : TMyRec; stdcall;
Run Code Online (Sandbox Code Playgroud)
记录的定义如下:
type TMyRec = record
Count : Cardinal;
Items : array of TMyItemRec;
end;
type TMyItemRec = record
ID : Cardinal;
Params : array of String;
end;
Run Code Online (Sandbox Code Playgroud)
现在我的问题是:如何使用Python ctypes访问调用dll的MyFunc的结果?我编写了两个模仿类型的类
from ctypes import *
class TMyItemRec(Structure):
_fields_ = [("ID", c_int), ("Params", POINTER(c_wchar_p))]
class TMyRec(Structure):
_fields_ = [("Count", c_int), ("Params", POINTER(TMyItemRec))]
Run Code Online (Sandbox Code Playgroud)
但是当我尝试读取这样的数据时:
my_dll = windll.Script
def GetMyRec(ID):
my_dll.MyFunc.argtypes = [c_uint]
my_dll.MyFunc.restype = TClilocRec
return my_dll.Script_GetClilocRec(ID)
Run Code Online (Sandbox Code Playgroud)
我收到访问冲突错误.
如何在Delphi中表示此C代码?
static char *mylist[] = {"aaa", "bbb", "ccc", NULL};
Run Code Online (Sandbox Code Playgroud)
我可以创建我的数组
keywords : array[0..3] of string;
keywords[0] := 'aaa';
keywords[1] := 'bbb';
keywords[2] := 'ccc';
//Compiler error -> E2010 Incompatible types: 'string' and 'Pointer'
keywords[3] := nil;
Run Code Online (Sandbox Code Playgroud)