如何使用 Google Maps python 客户端生成签名?

How to generate signature with Google Maps python client?

我没有找到关于SO的任何相关答案。我不知道如何使用 Google 地图 python 客户端以及 客户端 ID 客户端密码

Maps Python lib doc 在其文档中展示了如何实例化和使用客户端:

import googlemaps

gmaps = googlemaps.Client(client_id=client_id, client_secret=client_secret)

directions_result = gmaps.directions("Sydney Town Hall",
                                     "Parramatta, NSW",
                                     mode="transit",
                                     departure_time=now)

以及有关如何生成 client_secret(与签名相同)到 here 的文档的链接。

要生成签名,我们需要对 API URL 进行编码,我们将使用我们的私钥进行调用。

这意味着

我在这里错过了什么?

答案是与文档所说相反,client_secret 是私钥而不是签名。

这部分是错误的:

For a guide on how to generate the client_secret (digital signature), see the documentation for the API you're using.

See in the code client_secret 用于创建签名。