我正在尝试为我的 Android 项目实现 Android Management API Work profile
。此链接提供了注册企业、创建策略和配置设备的快速入门指南。
我猜快速入门是Colab notebook
用 Python 编写的(如错误所示)。我已在此 colab 笔记本中成功创建了一个企业,要创建运行此代码所需的基本策略
import json
policy_name = enterprise_name + '/policies/policy1'
policy_json = '''
{
"applications": [
{
"packageName": "com.android.chrome",
"installType": "FORCE_INSTALLED"
}
],
"debuggingFeaturesAllowed": true
}
'''
androidmanagement.enterprises().policies().patch(
name=policy_name,
body=json.loads(policy_json)
).execute()
这是我按下运行图标时遇到的错误:
TypeError Traceback (most recent call last)
<ipython-input-7-fa6c551fe8df> in <module>()
17 androidmanagement.enterprises().policies().patch(
18 name=policy_name,
---> 19 body=json.loads(policy_json)
20 ).execute()
/usr/local/lib/python3.6/dist-packages/googleapiclient/discovery.py in method(self, **kwargs)
740 raise TypeError(
741 'Parameter "%s" value "%s" does not match the pattern "%s"' %
--> 742 (name, pvalue, regex))
743
744 for name, enums in six.iteritems(parameters.enum_params):
TypeError: Parameter "name" value "LC01gzjgxa/policies/policy1" does not match the pattern "^enterprises/[^/]+/policies/[^/]+$"
有人可以帮我解决这个错误吗?