REQUEST_DENIED 对于 Google 矩阵 API
REQUEST_DENIED for Google matrix API
我不明白我做错了什么。我的 API 已启用。
这是我的代码:
# importing required libraries
import requests, json
# enter your api key here
api_key = 'API KEY'
# Take source as input
source = 'h4n1g1'
# Take destination as input
dest = 'h4n1p8'
# url variable store url
url = 'https://maps.googleapis.com/maps/api/distancematrix/json?'
# Get method of requests module
# return response object
r = requests.get(url + 'origins = ' + source +
'&destinations = ' + dest +
'&key = ' + api_key)
# json method of response object
# return json format result
x = r.json()
# by default driving mode considered
# print the value of x
print(x)
Google 距离 API 工作正常,但不是矩阵 API。
擦掉等号前的space,如果我在你那里我也会擦掉等号后的space。
r = requests.get(url + 'origins=' + source +
'&destinations= ' + dest +
'&key=' + api_key)
我不明白我做错了什么。我的 API 已启用。
这是我的代码:
# importing required libraries
import requests, json
# enter your api key here
api_key = 'API KEY'
# Take source as input
source = 'h4n1g1'
# Take destination as input
dest = 'h4n1p8'
# url variable store url
url = 'https://maps.googleapis.com/maps/api/distancematrix/json?'
# Get method of requests module
# return response object
r = requests.get(url + 'origins = ' + source +
'&destinations = ' + dest +
'&key = ' + api_key)
# json method of response object
# return json format result
x = r.json()
# by default driving mode considered
# print the value of x
print(x)
Google 距离 API 工作正常,但不是矩阵 API。
擦掉等号前的space,如果我在你那里我也会擦掉等号后的space。
r = requests.get(url + 'origins=' + source +
'&destinations= ' + dest +
'&key=' + api_key)