我想将对象用于Google Calendar API凭据,而不是使用JSON。
我尝试用客户端ID和客户端密钥创建字典。
您可以看到here
我想从一个对象获取客户端凭据,而不是<Counter>
<td
className={'active'}
onClick={ () => this.setState({currComponentId: element.id})}
>
{element.name}
</td>
</Counter>
。
答案 0 :(得分:0)
您引用的示例称为ServiceAccountCredentials.from_json_keyfile_name()
。
还有ServiceAccountCredentials.from_json_keyfile_dict()
的文档说:
已解析的JSON密钥文件中的工厂构造函数。
Args: keyfile_dict: dict-like object, The parsed dictionary-like object containing the contents of the JSON keyfile.
因此,如果您可以使用与从JSON文件解析的格式相同的格式提供凭据,则可以使用此方法。
其余参数与from_json_keyfile_name()
相同。