digital-signaturegoogle-directions-api

How to generate signature with Google Maps python client?


I did not find any relevant answer on SO. I can't figure out how to use the Google Maps python client with the client id and client secret.

The Maps Python lib doc show in its doc how to instantiate and use the client:

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)

And links to the documentation on how to generate a client_secret (which is the same as the signature) to here.

To generate a signature, we need to encode the API URL we'll be calling with our private key.

This means that

What am I missing here ?


Solution

  • The answer is that contrary to what the doc says, the client_secret is the private crypto key and not the signature.

    This part is wrong:

    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 that the client_secret is used to create a signature.